I have action override on New Case button which runs our custom component.
As you know, we can create a new Case from different places in org, e.g. from related lists. When creating a Case from related list on Account using standard action in Lightning we have prepopulated AccountId to the lookup field. Is it possible to do the same with custom component? I can't catch the AccountId using force:hasRecordId, because action override redirects me to the new page with custom component where I don't have a context of Account. URL also doesn't contain its Id. What can I do to grab Id of context object and populate it to my component?
Best Answer
There is a solution that does indeed work, but it's a bit fragile because it's parsing the entire URL (assuming a structure that could change): https://developer.salesforce.com/forums/?id=9060G000000UaqdQAC (look at Pascal Le Clech's answer).
However, we can build on this idea and make it more structurally sound by using https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable to grab the new inContextOfRef which gives us a URL Addressable Base 64 encoded string. Here's a slightly more stable solution to Pascal Le Clech's solution:
aura:component
controller.js