[SalesForce] finishLocation and URLFOR are resolving in Classic, not Lightning Experience

I have a Detail Page Button that calls a Visualforce page, from a Lightning Experience Service Console.

However, I can not get the finishLocation to resolve in the Lightning Experience UI.

This code below returns me to the case record within the Service Console (good), but the case is rendered in Classic UI (bad), while the rest of the Service Console is Lightning Experience.

Does anyone know the correct syntax to resolve in Lightning Experience?

<apex:page standardController="Case" tabStyle="Case" >
    <flow:interview name="Take_Case" finishLocation="{!URLFOR('/'+Case.Id)}" >
        <apex:param name="recordId" value="{!Case.Id}" />
        <apex:param name="userId" value="{!$User.Id}"/>
    </flow:interview>
</apex:page>

Best Answer

Set the return flow URL to Case.Id. Not sure if setting the finishLocation="{!Case.Id}" would be the same thing or not. I do not use flows so....

According to the documentation

To redirect users to a specific page in Salesforce after they click Finish:

/flow/flowName?retURL=url

where url is a relative URL (the part of the URL that comes after https://yourInstance.salesforce.com/ or https://yourInstance.lightning.force.com/).

  • For Lightning Experience URLs, Salesforce always redirects your users to the home page in Lightning Experience (one/one.app), even if the user has Salesforce Classic enabled. Users who don’t have permission to access Lightning Experience see an error message.

This flow URL redirects users to Accounts home, which exists in both Lightning Experience and Salesforce Classic.

/flow/myFlow?retUrl=001/o

When Lightning Experience users finish the flow interview, Salesforce redirects them to http://yourInstance.lightning.force.com/one/one.app#/sObject/Account/home. When Salesforce Classic users finish the flow interview, Salesforce redirects them to http://yourInstance.salesforce.com/001/o. Either way, Salesforce redirects users to Accounts home in their respective experience.

Unless this limitation applies to your use case:

You can’t use a flow variable as the value for the retURL parameter. If you want to use a flow variable to redirect a user, such as to a specific record, distribute the flow by using Visualforce.

Related Topic