I'm a starter in lightning, I have created a component contains input fields of a custom object (session__c
) and used that component as a quick action in the Account record page. On clicking of quick action I'm able to save a new record of session__c
.
Here is what I'm struggling, on saving the record it must navigate to session__c
object record detail page not to account detail page, but I don't know the functionality of it.
Can someone please let me know how to navigate to record detail page in lightning component ?
Best Answer
You can utilize
lightning:navigation
and thestandard__recordPage
page reference type here. Once the record has been saved and you have the record id (you will need to have this for the component to work), you can redirect the flow to that specific record page.Here's a snippet from the docs with relevant modification which will help you achieve the result. Note that you will need to adjust this accordingly. For further implementation details/example, refer to the docs linked.
In your component, you declare the
lightning:navigation
and then utilize in the JS:And then in the JS, once the record has been saved, just navigate to that record's id. Note that you will need to get the id of the record.