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
Ana K. BertuzziAna K. Bertuzzi 

Setting finishLocation passing arguments from the flow

How can I pass arguments from a flow to a URLFOR finishLocation? If I have an output variable in the flow, that is a 18-digit ID, can I reference it to build my URLFOR with something like {!flow.varID} ?

I'm trying to build something like

<apex:page>
   <flow:interview name="myFlow" finishLocation="{URLFOR('{!myFlow.varID}')"/>
<apex:page>

I've no experience building VF or Apex, so I would appreciate any help!

Kind regards,
Best Answer chosen by Ana K. Bertuzzi
ShashForceShashForce
Hi Ana,

You will need to use an "Interview" attribute in your flow:interview component and use a custom apex controller to achieve this.

Here are a couple of simple examples:
https://developer.salesforce.com/forums/ForumsMain?id=906F000000097pVIAQ&language=en
http://techman97.wordpress.com/2013/10/18/flow-and-finishlocation/

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank

All Answers

ShashForceShashForce
Hi Ana,

You will need to use an "Interview" attribute in your flow:interview component and use a custom apex controller to achieve this.

Here are a couple of simple examples:
https://developer.salesforce.com/forums/ForumsMain?id=906F000000097pVIAQ&language=en
http://techman97.wordpress.com/2013/10/18/flow-and-finishlocation/

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
This was selected as the best answer
Ana K. BertuzziAna K. Bertuzzi
Hi Shanshank,

Thank you, both the VF page and the Apex controller worked. And now I'm being direct to where I want to.

I'm using this to redirect the user to different record types, and to do so, while the flow runs, I'm storing the varRecordTypeId depending on some choices.

Is there a way I can end my flow without an additional screen? 
I'll explain a bit more:

My flow:

1) Screen with a picklist
2) Decision to split the different choices
3) Assignment to populate the variable varRecordType according to each choice

I was only able to make everything work adding another screen, and I think this is what actually saves the variable

4) Screen just saying thank you

without this final screen the stored variable is null.

I would like to trigger my controller URL just after the first screen. Is it possible?
Maybe finishLocation work only with the "Finish" button. If I have only 1 screen, I get only the "Next" button.

Thanks for your help again!

Ana