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.

Get Current Record id in Salesforce Screen flow
  1. To display the current record ID, add a screen element to the flow.
    • Enter the label for the screen element and add the display text component to the screen region. Enter the API name for the display text, then to fetch and display the record ID, click on the Insert a resource and select the recordId variable.
    • I have also added the resource {!Get_Accounts.Name} to display the account name. After this, click on the Done button.
Get Current record ids in Salesforce flows
  1. Save and Activate the Screen flow.
Create a flow to get record id in Salesforce

Create Action to Call the Screen flow.

Now, we will call the flow with the help of an action, or you can deploy the flow from the Lightning App Builder.

  1. Navigate to the object tab, click the settings icon, and select Edit Object.
    • In the object setup, click on the Button, Links, and Actions. Then, click on the New Action button.
How can we find my record ID in flow in Salesforce
  1. In the new action, select Flow‘ as the Action Type. Then, in the Flow field, select the flow we created to get the record ID. After this, enter the Label and click the Save button.
Get current account id in salesforce screen flow
  1. Now, go to the object Page Layouts, then in the next window, click on the Mobile & Lightning Actions.
    • Drag and drop the new action into the Salesforce Mobile and Lightning Experience section, then click the Save button.
Salesforce Screen Flow get current recordId
  1. On the object record page, click the Actions dropdown ( if not visible) and select the created quick action to display the record ID.
Display current record id using flow in Salesforce

When you click on the quick action, it will call the screen flow and display the ID and name of the current record.

Record id variable in Salesforce Screen flow

This way, we can retrieve the current record ID in the Salesforce screen flow by following the above steps.

Conclusion

By following the above steps, you will be able to retrieve and refer to the record ID of the current object records in the Salesforce screen flow, allowing you to manage your flows more efficiently.

You may also like to read.

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.