As it is now, I have a custom button at the top of an object's (ObjectA) page layout which launches a VisualForce page - which in turn launches a Flow - which ultimately creates a record for another object (ObjectB).

At the time that the user presses the custom button and the Flow is launched (with a Screen element) the URL is showing "https://c.cs42.visual.force.com/apex/NameOfMyFlow?scontrolCaching=1&id=a48430345St".

That record id which is shown at the end of the URL is the id of the original record which the user is viewing at the time of pressing the custom button to launch the Flow. That is the id I would like to capture and save to a variable, and then use the variable within the Flow. There must be a way to do that. I have tried using the param command within the VF page which is launched in order to try and capture the id but that doesn't look to be working. I don't know if it's incorrect coding or if it's just not possible in the way I'm trying.

Here is the VisualForce page which is launched at the time the custom button is pressed within ObjectA :

<apex:page StandardController="ObjectB__c" Extensions="New_With_Flow_Controller">
<flow:interview interview="{!myflow}" name="New_ObjectB__c" finishlocation="{!finishlocation}"/>
 <apex:param name="VarRecID" value="{!ObjectA__c.Id}"/>

I'm wondering if maybe there could be a way to capture the id by stripping it out of the URL - and then assigning it to the variable using param that way...?

Any help would be appreciated.

Thank you very much.

  • You can't, Since the record is New the ID does not yet exist
    – Eric
    Nov 6, 2015 at 22:24
  • 1
    @Eric, I understood the question to be asking how to capture the Id of the record he's launching the flow from, not the new record the flow will create.
    – crmprogdev
    Nov 7, 2015 at 17:10
  • @crmprogdev - that's correct. Do you know how to get that ID ?
    – Zoom_v
    Nov 8, 2015 at 16:49
  • Zoom, you've been a member here for over 2-1/2 yrs. I'd hope you'd know by now that if you want an answer to a question such as yours, at a minimum, you'd need to post the code for your custom button to show how you're trying to pass the Record Id to the page that launches the flow. Does that code link directly to the flow start? I don't have enough info to answer your question.
    – crmprogdev
    Nov 8, 2015 at 18:02
  • @crmprogdev - you're right and I apologize for that. I guess I wasn't sure if I was going in the right direction with my code so I didn't want to misguide anybody who might attempt to assist. I've edited the original post to include all of the code. If you could give any kind of help I would really appreciate it. Thank you.
    – Zoom_v
    Nov 9, 2015 at 14:10

1 Answer 1


I needed to put the param statement within the flow:interview...... It was outside that before and so the value for the variable wasn't being passed to the Flow.

This is the correct code :

<apex:page StandardController="ObjectB__c" Extensions="New_With_Flow_Controller">
<flow:interview interview="{!myflow}" name="New_ObjectB" finishlocation="{!finishlocation}"> 
<apex:param name="VarRecID" value="{!ObjectA__c.Id}"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .