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
DonneDonne 

Pass custom variable field from using Visual Flow to the "retURL"

I created a flow using Visual Flow along with a custom button to launch the flow.  Part of the flow is creating a new record which I am returning the "Record ID" as a variable in the flow.  I would like to include the record ID in the retURL path so the employee is sent to the details page of the new record once the flow is completed.

 

Any suggestions on how to make this work?

 

 

gksgks

My understanding is that you can only customize the flow finish behavior if you embed the flow in a visualforce page.

 

http://help.salesforce.com/help/doc/en/vpm_admin_onfinish.htm

 

I believe you would need to have the controller of the visualforce page to get the ID from the flow so that you could point the finish behavior to it.  Note that the help doc suggests using URLFOR, not RetURL (see bottom)

 

Does that help?

DonneDonne

I apologize for not clarifying further.

 

The retURL= is part of the logic for the button that opens the Flow.  See below.

 

/flow/ApptRequest?vaVen={!Vendor_c}&vaCustomer={!Customer_c}&retURL=

 

The button passes the customer and vendor information from the current page into "variable" fields in Visual Flow.  I then lookup other info and create a new record.  I want to be able to pass the new record ID into a url parameter in the buttom (retURL=) to send the employee to the details page for the new record.

 

I hope this helps clarify my request.

RajaramRajaram
You need to create a VF page. Take a look at my sample here: https://github.com/raja-sfdc/FlowDynamicRedirect
gksgks
On the create element in the flow, you can assign the ID of the newly
created record to a variable, and then you can reference that in your flow.

I'm still not clear on your question, as the button is used to launch the
flow, and the record is not created until the flow is run, so how could you
populate the URL w/ the created record ID?

If you want to point the user to the detail page for the new record, you
can either assign the record ID to a variable and create a link to the new
record that you display on a screen element at the end of your flow, or you
would need to embed into visualforce and customize the flow finish behavior.

Cheers
DonneDonne

Thank you for the feedback.  I was hoping the button would be able to use the variable field saved in the flow.

 

Any suggestions on how to create the dynamic url at the end of the flow?  I don't see a way to tell Visual Flow what to do upon completion of the flow once the user hits the "finish" button.

RajaramRajaram
My suggestion to use a VF page will work and is the only way to redirect the user to the detail page of any record created inside a flow. The button configuration would simply be changed to point to the url of the visualforce page instead of /flow/<flowname>
DonneDonne

Thank you.  I will try this suggestion.

 

Donne

DonneDonne
I assigned the record ID to a variable in the flow per your suggestion. How do I embed it in visualforce and customize the flow behavior?