How to pass a record id from Salesforce into a Flow?

Values can be passed into a Flow using the Visualforce page. Often this is done using querystring parameters. By default, the ManyWhoFlow (flow) Visualforce page includes two input parameters (both optional):

  • object-id: the unique identifier of an object in salesforce
  • object-type: the name of the object in salesforce – e.g. Case

In your Flow, these will automatically populate two String Values (you’ll need to create these or import these into your Flow if you’ve already created them):

  • SalesforceNotificationRecordId: String, Access: Input
  • SalesforceNotificationObjectName: String, Access: Input

We recommend using the above names as these same Values will be populated if you ever want to call your Flow from a Workflow Rule.

In your Flow, you can then use these Values to load the relevant data from Salesforce. For example, if you want to pass in a Contact Id, you’d perform the following steps:

  1. Create a new Flow with Salesforce as the Service used for identity
  2. Drag a Data Load element into the Flow
  3. Create a new Data Action
  4. For the Value to load, either select a Value of Kind: Object, Type: Contact or create a new Value of Kind: Object, Type: Contact.
  5. Use the Contact binding for loading the data
  6. Edit the filter and select: Get the data based on a unique identifier (this will load the Contact based on it’s ID in Salesforce)
  7. For the Value, select your SalesforceNotificationRecordId Value. This will hold the unique identifier for the Contact to load.
  8. Save the Data Action and Data Load
  9. Create a Step after the Data Action that has the following content: Hello {![Contact].[First Name]}!
  10. Save the Step and connect the Start to the Data Load and then another outcome from the Data Load to the Step.
  11. Publish the Flow.
  12. In the dialog, copy the flow-id={unique identifier}.

Then do the following inside Salesforce:

  1. Create a detail page button on the Contact record
  2. Construct the URL as follows: apex/flow?flow-id={the flow id you copied}&object-id={!Contact.ID}
  3. Save the button and add it to your page layout
  4. Click the button – note that the Step will provide the name of the Contact record that you launched the Flow from.