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?
3 Answers
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
@Pankaj I don't think you can do it by just a quick action. All of the quick actions (including global ones too) will stay on same page.
If you really need the redirecting thing, you need to implement a custom lightning component and use that as Quick Action, you can read about it more here https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action.htm
If it helps, Please mark this comment as best answer.
-
Thanks for your response Basant. Is there any workaround you can think of we can achieve this? Apr 25, 2017 at 17:15
-
Hi Pankaj, as i mentioned in my comment that If you really need the redirecting thing, you need to implement a custom lightning component and use that as Quick Action, you can read about it more here developer.salesforce.com/docs/atlas.en-us.lightning.meta/… If it helps, Please mark this comment as best answer. Apr 26, 2017 at 18:14
This is currently not available. I found the following Idea that asks for that.
https://success.salesforce.com/ideaView?id=0873A000000lFe8QAE