Using an Action to Pass the Entire Record to a Flow

Using an Action to Pass the Entire Record to a Flow

There are many ways to launch a flow (Read this post to learn all the ways to launch a flow). If it is a screen flow, then one of these options is to create an action on the object. Once you create a screen flow and activate it, it becomes available in the flow options of the action button. When you create an action, there is no setting about passing parameters to the flow. However, actions know to pass the Id of the record to a text variable in the flow. In order to pass the record Id, you have to create a text variable called recordId and mark it as input. Then the action will automatically pass the Id of the record, without a need to map the values manually.

As you can see in the picture below, you just need to select an active screen flow and give a name to the action.

Creating an action to call a screen flow

Just create an input text variable called recordId and the action will pass the Id of the current record to the flow. According to your requirements, you will need to perform a Get Record to bring the other fields of the record.

recordId input text variable
Get account according to recordId

Here is a simple screen flow that creates a case record related to the current account. Since there is a logic about account status, Get Records is performed to bring the account record’s fields.

Flow to create a case

Passing the Entire Record

According to this article, flow actions let you pass the record’s Id into the flow, but that’s it. Even though it is documented that actions can pass only the record Id to a text variable, there is a way to pass the entire record as well.

In order to do so, create a record variable called recordId and mark it as available for input. Don’t forget to select the object. When it is a record variable and not just a text variable, action automatically passes the entire record to the variable. If you don’t know the difference between a text variable and a record variable, you can read this post.

recordId variable to be used to pass record to the flow

Since the entire record is passed to the flow, there is no need to perform a Get Record. You can directly reach to the fields of the account record.

Final version of the flow after you pass entire record

Advantages

  • There is no need to perform a Get Record.
  • Since there won’t be an extra Get Record, it will not consume SOQL query governor limit.
  • Since there won’t be an extra Get Record, flow will be faster.

Disadvantages

  • Because it is a record variable, you cannot use this flow for multiple objects. However, if you use the recordId as a text variable, you can use the same flow with different objects and apply a different process for each object.

Be the first to comment

Leave a Reply

Your email address will not be published.


*