Skip to main content
Version: 1.28 (Current)

Run SOQL Query (obsolete)

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens, SOQL

Runs a SOQL query in Salesforce and saves fields from the first record in tokens, so later actions can use them. The Salesforce login details are entered in the action itself.

caution

This action is obsolete. Use Run SOQL Query with a Salesforce connector instead. A connector keeps the password and security token encrypted in one place, so you don't repeat them in every action. See Moving to Run SOQL Query.

note

This action is part of the Salesforce add-on (DnnSharp.Salesforce). The add-on is installed separately and needs the SALESFORCE feature in your license. If it isn't licensed, the action fails with a "not licensed" error. If you don't see the Salesforce actions, the add-on isn't installed.

Typical Use Cases​

  • Keep existing applications that already use this action running until you move them to Run SOQL Query

Don't use it to​

  • Build anything new. Use Run SOQL Query with a Salesforce connector instead.
  • Load many records to loop over. The action only reads the first record.
  • Create a record. Use Create a Salesforce Entity instead.
Action NameDescription
Run SOQL QueryThe current version of this action, using a Salesforce connector.
Add Salesforce ConnectorCreates a Salesforce connector.
Test ConnectorChecks that a connector can sign in.
Create a Salesforce Entity (obsolete)Creates a record in Salesforce, with the login details in the action.
Add to campaign (obsolete)Adds a lead or contact to Salesforce campaigns, with the login details in the action.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
Salesforce Login URLThe Salesforce login domain, for example https://ap1.salesforce.com/. If the value doesn't end with /services/oauth2/token, that path is added. Leave it empty to use https://login.salesforce.com/services/oauth2/token.Yesempty stringNo
Salesforce UsernameThe Salesforce username.Yesempty stringYes
Salesforce PasswordThe Salesforce password.Yesempty stringYes
Salesforce Security TokenThe Salesforce security token for the user.Yesempty stringYes
SOQL QueryThe SOQL query to run, for example SELECT Id, FirstName FROM Lead WHERE Email = '[Email]' LIMIT 1. Tokens are replaced as plain text, with no escaping. See Tokens in the query.Yesempty stringYes
On ErrorActions to run if the sign-in or the query fails. They can use the [ErrorMessage] token. See Errors.NoemptyNo

Output Parameters Reference​

ParameterDescriptionSupports TokensDefaultRequired
Extract ColumnsSaves fields from the first record in tokens. Each row has a Column Name, the Salesforce field name as it's returned, for example Email, and a Store As token name, for example LeadEmail. Enter the token name without brackets. If this list is empty, the action does nothing. See Reading the result.YesemptyYes

The action creates one token for each row in Extract Columns, for example [LeadEmail]. If the action fails, [ErrorMessage] contains the error.

Behavior​

Apart from how it signs in, this action works exactly like Run SOQL Query. The same rules apply to reading the result, tokens in the query and errors.

warning

Tokens in SOQL Query aren't escaped. Don't put user input straight into the query. See Tokens in the query.

Moving to Run SOQL Query​

  1. Create a Salesforce connector with the login details from this action, using the connectors page or Add Salesforce Connector.
  2. Check it with Test Connector.
  3. Add a Run SOQL Query action, select the connector, and copy the other parameters across.
  4. Remove this action.
This actionRun SOQL Query
Salesforce Login URLLogin Url on the connector
Salesforce UsernameAccount Username on the connector
Salesforce PasswordPassword on the connector
Salesforce Security TokenSecurity Token on the connector
(none)Connector
SOQL QuerySOQL Query
Extract ColumnsExtract Columns
On ErrorOn Error

The parameter IDs of SOQL Query, Extract Columns and On Error are the same in both actions, so you can copy them as they are.

Considerations​

  • The password and security token are stored in the action. Anyone who can edit or export the action's settings can read them. Pass them through tokens or, better, move to a connector.
  • The login isn't shared. When the password or token changes in Salesforce, you have to update every action that uses it.
  • The action signs in on every run, which counts against your org's API limits.
  • Sandbox orgs need the sandbox login domain, for example https://test.salesforce.com, in Salesforce Login URL.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Load a lead by email​

This action finds the newest lead with the email in [Email] and saves its ID and name in tokens. The login details come from tokens, not from text typed into the action. The email should be validated before this action runs.

{
"Title": "Run SOQL Query (obsolete)",
"ActionType": "RunSOQL",
"Description": "Load the lead with this email",
"Parameters": {
"sforceLoginURL": "",
"sforceUserName": "[SalesforceUsername]",
"sforcePassword": "[SalesforcePassword]",
"sforceSecurityToken": "[SalesforceSecurityToken]",
"SOQLQuery": "SELECT Id, FirstName, LastName FROM Lead WHERE Email = '[Email]' ORDER BY CreatedDate DESC LIMIT 1",
"ExtractColumns": [
{
"name": "Id",
"value": "LeadId"
},
{
"name": "FirstName",
"value": "LeadFirstName"
},
{
"name": "LastName",
"value": "LeadLastName"
}
],
"OnError": [
{
"Title": "Log Error",
"ActionType": "LogError",
"Parameters": {
"Message": "Salesforce lead lookup failed: [ErrorMessage]"
}
}
]
}
}

Revised 09/27/2026