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
Baz DensonBaz Denson 

return to record on lightning component close

I have built a component to override the new action on my Previous_address__c object which is a master detail relationship to the Account object.

When I hit save or cancel, the comonent stays open. I would like it to return to the account record I clicked 'new previous address' on.

Can anyone give me some pointers?

TIA
Best Answer chosen by Baz Denson
Khan AnasKhan Anas (Salesforce Developers) 
Hi Baz,

Greetings to you!

You need to use force:navigateToSObject, this event enables you to navigate to an sObject record specified by recordId.

Please refer to the below links which might help you further with the above requirement.

https://andyinthecloud.com/2017/05/30/overriding-standard-actions-with-lightning-components/

https://trailhead.salesforce.com/en/content/learn/projects/workshop-override-standard-action/override_4

Please note, Salesforce recommends using lightning:navigation component with the standard__recordPage page type instead of force:navigateToSObject.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Baz,

Greetings to you!

You need to use force:navigateToSObject, this event enables you to navigate to an sObject record specified by recordId.

Please refer to the below links which might help you further with the above requirement.

https://andyinthecloud.com/2017/05/30/overriding-standard-actions-with-lightning-components/

https://trailhead.salesforce.com/en/content/learn/projects/workshop-override-standard-action/override_4

Please note, Salesforce recommends using lightning:navigation component with the standard__recordPage page type instead of force:navigateToSObject.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Alain CabonAlain Cabon
@Baz Denson

Before the navigation above, you can force the close of the action panel.

https://developer.salesforce.com/docs/component-library/bundle/force:closeQuickAction/documentation​​​​​​​ (https://developer.salesforce.com/docs/component-library/bundle/force:closeQuickAction/documentation)
 
// Close the action panel
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();