+ Start a Discussion

visual flow lightning component redirect - A complete answer for this resolved question

Hi Team,

I posted a comment on this question - https://developer.salesforce.com/forums/ForumsMain?id=9060G0000005ohuQAA
, however didn't get a response hence posting a question.
If you can please help with the .cmp and .js code.

Thanks in advance.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Anidev,

Greetings to you!

By default, when a flow finishes, a new interview starts and the user sees the first screen of the flow. To instead redirect the user to another page, build or install a local action that does so. Then add the action to your flow with a Core Action element. For example, local action can open a record, list view, or URL or to show a toast message. Or it can use the Lightning Console JavaScript API to close a console tab.

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


https://help.salesforce.com/articleView?id=flow_concepts_finish_override.htm&type=5 (https://help.salesforce.com/articleView?id=flow_concepts_finish_override.htm&type=5)


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
Hi Khan Anas,

Really appreciate your response.
I have tried each one of those mentioned above - none of them working :(  
That is why posted on the forum.

This is the lightning component

design ---

   <design:attribute name="recordId" label="Record ID" />

js ---

({    invoke : function(component, event, helper) {
   // Get the record ID attribute
   var record = component.get("v.recordId");
   // Get the Lightning event that opens a record in a new tab
   var redirect = $A.get("e.force:navigateToSObject");
   // Pass the record ID to the event
      "recordId": record
   // Open the record

cmp ---

<aura:component implements="force:lightningQuickAction,lightning:availableForFlowActions">
   <aura:attribute name="recordId" type="String" />

Flow picture attached.

Thanks and Regards,

User-added image