Unable to redirect to specific page using flow finish location

I have created a flow and trying to pass a value to a finish location using
visualforce page. In the finish page i am able to get the value but unable
to redirect the customer to that particular record.

Value is coming in the createdid.Using the below code I am getting

Formula Expression is required on the action attributes.I am unable to redirect

VF page :

<apex:page Controller="ContactSimple"  action='router'> 
<flow:interview name="Survey_customers" interview="{!myflow}" reRender="nameSection" />
<apex:outputText id="nameSection" value="Contact First Name: {!firstName}"/>
</apex:page>

Controller:

public class ContactSimple {
public Flow.Interview.Survey_customers myflow {get;set;}
public String firstName;

public String getFirstName() {
// Access flow variables as simple member variables with get/set methods 
if(myflow==null) return 'na';
else return myflow.createdid;
}
public pagereference getRouter(){
    PageReference p ;   

        p = new PageReference('/myflow.createdid');

    return p;
}
}

Answer

You’re trying to redirect to the literal page “/myflow.createdid”, which isn’t where you’re trying to go. Instead, you want something like:

return new PageReference("/"+myflow.createdid);

Also, you need to actually specify your finishLocation attribute on the interview:

<flow:interview name="Survey_customers" interview="{!myflow}" reRender="nameSection" finishLocation="{!router}" />

Attribution
Source : Link , Question Author : cloudy-ritz , Answer Author : sfdcfox

Leave a Comment