I am trying to set the id of the current record to a variable in a flow.

My flow runs when a user presses a button from one of any number of page layouts of different objects. Therefore a user can be on an account page layout or they can be on the contact page layout and they can click on a button that runs a flow. As part of the flow I create a record and I capture some input variables from the user. However I'd also like to capture the URL or the id of the record they are currently on in order to store it for future reference, is there a way to do this either with Process Builder or Visual Workflow (Flow)?

1 Answer 1


Behind Javascript button use this code to call a flow.

Here for example, vSelectedIds is getting passed to the flow.


var selectedAccount = {!Account.Id)}; 

var serverUrl = '{!$Api.Partner_Server_URL_260}';
var position = {!FIND( '/services', $Api.Partner_Server_URL_260)};
var base = serverUrl.substring(0,position-1);

var url = base +encodeURI('/flow/Update_Field_Values?vSelectedIds=' + selectedAccount);

window.open(url, '_self');

In the flow, define a variable called vSelectedIds. It will be automatically get assigned through parameters passed from button click.

Refer my blog post: Pass Collection to Visual Workflow, parse and save case records in case it helps.

You must log in to answer this question.

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