[SalesForce] Overriding Related list standard button with Lightning Component & prepopulate parent record field in form

Is there any way to override 'New' standard button with lightning component and refer the parent record as prepopulated value in record creation screen?

I saw in some posts to achieve this using visualforce override and pass parent recordid in url but I wanted to achieve using only lightning component.

Please let me know if more details are needed.

Screenshot and highlighted standard action

As shown in screenshot I have to override this standard 'New' action to open a form and prepoulated opportunity and account information and few fields of Agreement record itself.

Best Answer

You haven't described what you're actually trying to achieve in the question (please do add that to your question), so I'm not sure if my first suggestion will be enough, but I have two suggestions...

The first thing I'd do is see if you can achieve your aim using a Quick Action instead of writing a component. If you can, then that saves you having to write/maintain code and that's great.

If that doesn't work, suggestion number two is to write a custom component Write it like this:

<aura:component description="NewObjectAction" implements="force:LightningQuickAction,force:hasRecordId">
    Parent record is {!v.recordId}
</aura:component>

Set that up as a Lightning Component type of action on the parent object and it will receive the recordId of the parent record when pressed.

Edit

Two ideas weren't enough! After the question was updated, the actual requirement was to have custom actions appear in the standard related list in LEX. Which is not possible (yet) vote on the idea here:

https://success.salesforce.com/ideaView?id=0873A0000003TXFQA2

So the only options are to put this functionality on the main record's actions in the top-right of the UI, or to write your own related-list.

Related Topic