If we override the new button with custom component, then how we can get the record id of the record while clicking the New button from the related list?

I have used workspaceAPI to get the recodeId.

getCaseId : function(component) {
    var workspaceAPI = component.find("workspace");
    workspaceAPI.getFocusedTabInfo().then(function(response) {
        var strVal = response.pageReference.state.ws;
             component.set('v.caseId', response.recordId);
        }else if(strVal){
            strVal = strVal.replace("/lightning/r/Case/", '');
            strVal = strVal.replace("/view", '');
            component.set('v.caseId', strVal);
        //console.log('CASE ID:::' + component.get('v.caseId'));
    .catch(function(error) {

This is also working. But I am searching alternative solution.

  • 1
    Please provide some example code that you are using to allow people to better assist you.
    – sevargdcg
    Feb 22, 2021 at 16:46
  • 1
    I have added the code that I am using Feb 23, 2021 at 17:49

1 Answer 1


Last time I checked, accessing the parent Id from related list's button wasn't possible.

Here is the idea: Get parentId when overriding standard actions with a lightning components

There were 2 workarounds:

  1. Wrap the aura component in a VF page and use it for override.

  2. Parse the URL and get the Id.

  • Getting the Id from the URL is working Feb 23, 2021 at 17:41
  • We can use workspaceapi to get the record id. May I know which one is best (workspaceapi or lightning:isUrlAddressable) Feb 25, 2021 at 13:31
  • Whichever you find is easier to work with. :)
    – Raul
    Feb 27, 2021 at 13:39

Not the answer you're looking for? Browse other questions tagged .