Run SOQL Query (obsolete)
Audience:
Low-code EngineersSkill 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.
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.
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.
Related Actions
| Action Name | Description |
|---|---|
| Run SOQL Query | The current version of this action, using a Salesforce connector. |
| Add Salesforce Connector | Creates a Salesforce connector. |
| Test Connector | Checks 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
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Salesforce Login URL | The 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. | Yes | empty string | No |
| Salesforce Username | The Salesforce username. | Yes | empty string | Yes |
| Salesforce Password | The Salesforce password. | Yes | empty string | Yes |
| Salesforce Security Token | The Salesforce security token for the user. | Yes | empty string | Yes |
| SOQL Query | The 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. | Yes | empty string | Yes |
| On Error | Actions to run if the sign-in or the query fails. They can use the [ErrorMessage] token. See Errors. | No | empty | No |
Output Parameters Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Extract Columns | Saves 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. | Yes | empty | Yes |
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.
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
- Create a Salesforce connector with the login details from this action, using the connectors page or Add Salesforce Connector.
- Check it with Test Connector.
- Add a Run SOQL Query action, select the connector, and copy the other parameters across.
- Remove this action.
| This action | Run SOQL Query |
|---|---|
| Salesforce Login URL | Login Url on the connector |
| Salesforce Username | Account Username on the connector |
| Salesforce Password | Password on the connector |
| Salesforce Security Token | Security Token on the connector |
| (none) | Connector |
| SOQL Query | SOQL Query |
| Extract Columns | Extract Columns |
| On Error | On 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, inSalesforce Login URL.
Examples
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