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
TrueCloudUserTrueCloudUser 

example of finishing at newly created record

Hi All,

 

Question - I am using Apex with my Flow successfully enough, however challenge has arisen to gracefully close out the flow itself.

 

My Flow concludes with creation of a new record, however I cannot figure out how to pass the Id of the new record back to the VF page component so that the user can click to finish and then be taken to that new record i.e. how do I put a newly created account Id into the <flow:interview finishLocation="> account Id<" ?

 

Any suggestions most appreciated.

 

Cheers.

 

Chris JohnChris John

The following doc

https://login.salesforce.com/help/doc/en/vpm_admin_onfinish.htm

 

Shows something like this:

 

<flow:interview name="flowname" finishLocation="{URLFOR('/001D000000IpE9X')}"/>



I imagine in your case the Id of the record will be dynamic (created within the Flow), so you may need to look at exposing the Flow variable so that it's value can be referenced from the VF page, though I've not tested whether that will do what you need.

TrueCloudUserTrueCloudUser

Thanks for replying.

 

Yep I got as far as the finishLocation parameter, however as per your thoughts the example I cant find is how to populate that merge field once the flow is completed.

 

What I might try is creating the record and then stamping it with some sort of flag so I can query for it seperately in the page controller and then return the record id.

 

Seems an inefficient way to do it, but may just have to for now.

 

Cheers.

Chris JohnChris John

I wonder if it would work if the finishLocation was a Controller function that returned a variable value (which was mapped to the exposed Flow variable).

apple_saeapple_sae

Try this it's work for me

 

<apex:page standardController="Account" showHeader="false" sidebar="false" id="MyPage">
 <flow:interview name="accFlow" finishLocation="/{!Account.Id}"/>
</apex:page>

 let me know if you get any error.