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
Scott0987Scott0987 

Start force.com flow with variables populated

To warn you I am new to apex.  Here is my situation.  I have created a flow (not workflow but flow) that my salesguys use for their sale.  Right now I have created a button that is labeled Start Sale.  I have placed the button on the lead and the button is just a url that goes to /flow/Sales_Flow which is the flow.  The salesguys have to copy the ID out of the address bar on the lead to get the ID of the lead into my flow.  I am hoping to create an apex button or code of some sort that will take the ID of the lead that the button is on and put that ID into a field that populates a variable called leadID in my flow.  I figure there has got to be a way to have that variable populated when the flow starts so that they do not have to copy it, but I cannot figure out how to do it.

Thanks for the help.

Best Answer chosen by Admin (Salesforce Developers) 
Blake TanonBlake Tanon

In the button you have for the flow, you can add in the below to teh end of your url

 

?leadID={!Lead.Id}

All Answers

Blake TanonBlake Tanon

In the button you have for the flow, you can add in the below to teh end of your url

 

?leadID={!Lead.Id}

This was selected as the best answer
Scott0987Scott0987

I had tried this before and it did not work.  I figured out what I did wrong after looking at this though.  I had the variable set to private.  I needed to set the input/output type to allow input.