+ Start a Discussion
LinThawLinThaw 

How to open Record Page after finish Flow?

Hi there,

In Lightning Flow, I want to open case record detail page after finish my screen Flow.

To solve this, I added Lightning Component to Last Screen of my Flow.
Is it good idea to implement it or not?
Is there other ways to do this, please let me share.
<aura:component implements="lightning:availableForFlowScreens,lightning:availableForFlowActions">
    <aura:attribute name="recordId" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>    
</aura:component>
 
({    
    doInit: 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
        redirect.setParams({
            "recordId": record
        });
        
        // Open the record
        redirect.fire();
    }
})

Regards,
LinThaw
Raj VakatiRaj Vakati
That is the best way only .. you have to customize the finish button to go to record page and 
 If you Set Flow Finish Behavior with a Flow URL in Lightning Experience URLs always redirect to the home page in Lightning Experience.


By default, when a flow user clicks Finish, a new interview starts and the user sees the first screen of the flow again. By embedding a flow in a custom Lightning component, you can shape what happens when the flow finishes by using the onstatuschange action. To redirect to another page, use one of the force:navigateTo* events such as force:navigateToObjectHome or force:navigateToUrl.


Refer this link


https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/components_using_flow_onfinish.htm


But make sure you are checking the flow finish logic 
if(event.getParam("status") === "FINISHED") {
        // Redirect to another page in Salesforce, or
        // Redirect to a page outside of Salesforce, or
        // Show a toast, or...
    }


 
Andy Kallio 7Andy Kallio 7

Yes, there is an easier way to do this. There is a component that has already been developed. You can find it and others here: https://unofficialsf.com/flow-resources/
This group is also a helpful place: https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000001rzc

 

More specfically it is the one called 'navigate to sobject' on this page: https://unofficialsf.com/flow-actions/

 

I have used it several times. 

LinThawLinThaw
Hi Andy Kallio, Thanks for sharing.
Raj VakatiRaj Vakati
Yes .. that true .. but  LinThaw  is already having the code ( Offcourse we can do same as with the flow actions )  and i dnt see any harm in the flow customize finish button 



 
LinThawLinThaw
Hi Raj Vakati, Thanks for idea.
Raj VakatiRaj Vakati
Can you close this threads .. if you dnt need any additional info 
LinThawLinThaw
please let me wait other ideas.
Raj VakatiRaj Vakati
sure .. there are two options flow actions vs using the finish button .. but your case flow finish is better option
LinThawLinThaw
User-added image
Core Action is working well instead of using Screen. 
Love this one.
https://help.salesforce.com/articleView?id=flow_concepts_finish_override.htm&type=5
jclawsonjclawson
@linthaw can you explain exactly what option in Core Action you selected? I can't seem to figure out how to do that with the link. It is a little intense and doesn't show visuals of what they did. 
BobPBobP
I tried this and it's not working for me. I'm not sure what my formula should be if i want the action to return to the home page. It seems easy but it's not working and I'm getting frustrated. 

User-added image

User-added image
Tran Thi Hong Ngoc 4Tran Thi Hong Ngoc 4
I tried and found that this redirect logic works on 
Flow Builder
Flow detail pages or list views
Web tabs
Custom buttons and links

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

I couldn't test this with custom button