Execute SOQL
Execute a custom SOQL query and use the results in Flow
This is an advanced action. If your query is not specific enough, your flow may run slowly or fail. Only use this if you have a thorough understanding of SOQL and the built-in Get Records action is too restrictive to do what you need.
Takes a SOQL query and executes it within a Flow, retrieving the records according to the specified query. This provides a useful tool for getting around some of the limitations of the built-in Get Records
action.
For example, consider the requirement to fetch a list of Users based on whether their Role name contains the word "Sales". Using Get Records
will require you to use OR conditions with hard-coded Role Ids. Using this action, you can use SOQL's built-in relationship queries like so:
Other use cases for this include IN/NOT IN queries or LIMIT clauses to retrieve only a subset of records.
To use the results, you'll need to store the output in a variable of type Record with the Object Type set to the object you're querying (e.g. User in the example above). Be sure to specify that the variable is a Collection.
When you use records retrieved by this action, only the fields you specify will be available.
Inputs
query
Yes
String
The SOQL query to be executed
Outputs
records
List<SObject>
The collection of records retrieved by the SOQL query. The object type of these records is determined by the FROM clause in the SOQL query itself.
Last updated