function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
brentdowney.ax1325brentdowney.ax1325 

Flow finishLocation equal to originating record

I have successfully embedded my Flow into a new visualforce page, created a custom button to run the component, and everything is working perfectly, except for the finishLocation. The flow is generated from an account, and I want the user to return to the account when the flow has been completed. 

 

After scouring the boards for a few hours and trying differnt potential solutions (including: http://boards.developerforce.com/t5/Visual-Workflow/Flow-finishLocation-equal-to-originating-record/m-p/534037#M912), I can't seem to get this thing to work! The flow is generated from the account, and it is used to create an event and/or a task on the account record.

 

Here is the code:

 

<apex:page standardController="Account" tabStyle="Account">
    <flow:interview name="NA_AR_Sales_Call_Wizard" finishLocation="{!URLFOR('/{!Account.Id}')}">
        <apex:param name="varAccountID" value="{!Account.ID}"/>
    </flow:interview>
</apex:page>
Jeff MayJeff May

use / +{!Account.Id} not URLFOR() 

 

finishlocation='/{!Account.Id}'

brentdowney.ax1325brentdowney.ax1325

Thanks Jeff. I am getting an Invalid Page Redirection error now:

 

The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance.

 

Jeff MayJeff May

I put my page generation in a page controller method that returns a PageReference, then set the finishlocation="{!finishpage} 

 

My controller method is:

 

return PageReference('/' + contactId);

brentdowney.ax1325brentdowney.ax1325

Forgive me...novice coder - learning as I go!

 

You have the page controller in the visualfroce page, or do you have it created as a class?

Jeff MayJeff May

No problem.  This is a learning experience for all of us -- its why these Boards are so active and useful.

 

Here is my page controller class:

public with sharing class flowLauncherController {

    public String theContactID {get;set;}
    public String theflowName {get;set;}
    
    public surveyLauncherController() {
       theContactID = ApexPages.currentPage().getParameters().get('contactId');        
       theflowName = ApexPages.currentPage().getParameters().get('flowName');        
    }

    public PageReference getafterFinish() {
        return new PageReference('/' + theContactID);
    }	

}

 

and here is my VF page:

 

<apex:page controller="flowLauncherController" tabStyle="Contact" >
<flow:interview name="TheActualFlowName" finishLocation="{!afterFinish}">
 <apex:param name="contactID" value="{!theContactID}"/>
 </flow:interview>
</apex:page>

 

My custom button sends the params to the page, which are collected by the controller and passed to the interview.  Note that flowname is not currently used (since it has to be hard-coded in <flow:interview> right now, but I am an optimist that someday I will be able to have 1 VF page to launch any flow.

 

MicheleMcgeoyMicheleMcgeoy

Hi Jeff:

I'm trying to run the code you posted and am getting this error message.

Error: Compile Error: Invalid constructor name: surveyLauncherController at line 6 column 12

 

Is there a " surveyLauncherController" that could be posted as well?

 

Thanks, Michele

Jeff MayJeff May

Sorry. that is just a typo in my code.  Change the constructor method name in the controller I posted to be the same as the controller class name and you'll be all set.