[SalesForce] Unable to redirect to the record created using Quick Action in lightning experience

I created a quick action named 'Create Opp' on Account to create an Opportunity and launch it in lightning experience from the Account detail page. I am able to create the Opportunity record successfully. My requirement is to redirect to the created Opportunity page which is not happening. Is there any workaround to achieve this?

Best Answer

It appears this is still not a standard function for salesforce, but I found this work around. You can drag and drop this lightning component to any lightning page your quick action is on and it will redirect to the newly created record. It uses the link from the default success toast message so be sure to leave the 'Success Message' field blank.

Hope it helps. Link and OP at the bottom

<aura:component implements="flexipage:availableForAllPageTypes">
    <aura:handler event="force:showToast" action="{!c.redirectToNewRecord}"/>
</aura:component>
({
    redirectToNewRecord: function(component, event, helper) {
        var messageData = event.getParam('messageTemplateData');
        if (!$A.util.isEmpty(messageData)) {
            var executionComponent = messageData[1].executionComponent;
            if (!$A.util.isEmpty(executionComponent)) {
                var recordId = executionComponent.attributes.recordId;
                var navEvt = $A.get("e.force:navigateToSObject");
                navEvt.setParams({
                    "recordId": recordId,
                    "slideDevName": "related"
                });
                navEvt.fire();
            }
        }
    }
})

-Mateusz Otręba November 15, 2019

https://salesforceprofs.com/navigate-to-created-record/

Related Topic