function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kalpesh Vyas 14Kalpesh Vyas 14 

how to get parent record id, if New button of related list is getting overridden by lightning component.

I have a master detail relationship between 2 objects, Qualification(Master) and Team Member (detail).
Now I am overriding the "New" functionality of Team member by lightning component,it works good on list view of team member.

But when I open a qualification record and go to Team Member related list, Clicking on "New" button, it redirets to new window, and does not provide any record id (I mean Qualification id here), is it possible to get "QUALIFICATION  id on lightning component"?
Sriram PenkeySriram Penkey
Hi Kalpesh Vyas, Were you able to get QUALIFICATION Id here by clicking "New" Button from related list?

If so, Please let me know the approach.
Thanks, Sriram.
Kalpesh Vyas 14Kalpesh Vyas 14
No Sriram,
No way as of now, just as a workaround we used quick action and created a button on parent (Qualification here), to add a detail object record(team member).
Sriram Penkey 5Sriram Penkey 5

Thanks Kalpesh, Im just going with overriding VF page which has lightning component added to it.

Facing problems with events.

Lorna Bingham 8Lorna Bingham 8
@Sriram where you able to find a solution for this? I am facing the same problem. 
Sriram PenkeySriram Penkey

@lorna I still follow the same approach as there is no other way to retrieve master record ID in related list overriden button (New).

Approach I followed: Override std New button with VF page which creates lightning component.

<apex:page standardController="detailSObject__c" >
    <head><apex:slds /></head>
	<apex:includeLightning />
    <script type="text/javascript">
        var masterRecId = '{!JSENCODE(detailSObject__c.lookupFldToMaster__c)}';
        //Create lightning cmp
    </script>
</apex:page>