Get Current Record ID in Salesforce Flows

In Salesforce flows, accessing the current record’s ID is often essential, especially for updating, deleting, or fetching related records.

In this Salesforce tutorial, we will learn how to get the current Record ID in Salesforce Flows. Specifically, the screen flows.

Get Current Record ID in Salesforce Screen Flow

To obtain a current record ID in Salesforce Screen flow, we must first create a flow. To do this, navigate to Salesforce Lightning’s setup page and follow the steps below.

  1. In the Flows setup, click on the New Flow button. In the next window, select the option Screen flow and click on the Next button.
Fetch current record id in Salesforce flow
  1. To fetch the Record ID of the current record, we will create a variable. To do this, click on the toggle bar and select the New Resource button.
Get record id in Salesforce Screen flow
  1. In the new resource, enter the following fields.
  • Select the Resource Type as a Variable.
  • Enter the API Name as recordId and select the Data Type as Text.
  • Finally, select the checkbox ‘Available for input’ and click the ‘Done’ button.

When we create a variable, such as recordId, which is available for input, the flow automatically takes the current record ID into the flow.

How to get record id in Salesforce flow
  1. Now, we need to pair the screen flow with a record; for that, add the Get record element to the flow. In this example, we will fetch the account records.

Enter the Label of the get record element, then select the object whose records you have to fetch. In the condition requirements, map the object ID to the record variable recordid.