UiPath Activities

The UiPath Activities Guide

Execute SOQL


Executes a Salesforce Object Query Language (SOQL) command in Salesforce and returns the query results in a DataTable. This activity only functions inside a Salesforce Application Scope activity.



  • DisplayName - The display name of the activity.


  • SOQLCommand - The SOQL command that you want to run. This must be a valid SOQL command. This field supports only strings and String variables.


SOQL defines several escape sequences that are valid in queries so that you can include special characters in your search text. You can escape new lines, carriage returns, tabs, quotes, and more. The escape character used in SOQL is the backslash (\) character. You can find out more information by checking the official Salesforce documentation, which can be found here.

If every search string that is concatenated into the SOQL Command is not escaped, the activity throws a MALFORMED_QUERY error when these special characters are present in the search string. Each search string should be escaped as follows before concatenating:

str_Company.Replace(“\”, “\\”).Replace(“'“, “\'”).Replace(“”””, “\”””)

e.g. If the SOQL command is

"Select Id from Account where Name = '" + str_Company + "'"

and str_Company is John's Pizza is passed without being escaped, a MALFORMED_QUERY error is returned. The correct SOQL command is:

"Select Id from Account where Name = '" + str_Company.Replace(“\”, “\\”).Replace(“'“, “\'”).Replace(“”””, “\”””) + "'"


  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.


  • Result - The result of running the SOQL command in Salesforce, stored in a DataTable variable. This field supports only DataTable variables.
  • SalesforceStatus - The status that is returned from Salesforce once the action is completed, stored in a SalesforceStatus variable. This field supports only SalesforceStatus variables.

Updated 7 months ago

Execute SOQL

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.