SalesForce Actions
Last updated
Last updated
The Salesforce Action node allows you to retrieve, create and update a record via SOQL query.
SOQL stands for Salesforce Object Query Language. You can use SOQL to read information stored in your organization's database. SOQL is syntactically similar to SQL (Structured Query Language). You can find the best practices on building SOQL Queries here.
You can only initiate this query if you successfully authenticated using the Salesforce Authentication node before triggering this node.
Field Name | Description |
---|---|
Tenant Domain | This is your account's unique org-specific subdomain for Salesforce login and application URL |
Token Parameter | This parameter stores the access token you received previously in the Authentication node |
Here's how to find your tenant domain:-
This is your account's unique org-specific subdomain for Salesforce login and application URL. If you use Salesforce Lightning Experience, you can find it in the URL of your salesforce account (https:// your-tenant-domain.lightning.force.com) or you can go to Settings → Company Settings → My Domain→ Current Domain.
When you enter your tenant domain into the SalesForce Action Node be sure to add only the part before “my.salesforce” from the URL. For example if the whole URL reads www.this-is-a-demo-for-you.user.my.salesforce.com in the tenant domain enter only “this-is-a-demo-for-you.user”.
Receive data from a Salesforce record via SOQL query.
The Object Record ID is an important field that you may need to retrieve. The Record ID is the unique identifier assigned to each record (under an object) in your Salesforce account. When using Get Record action, you will need to map in the response for the Record ID. This Record ID can be used at later stages while creating/updating a record which has a salesforce field with data type as “Lookup” (eg: Under “Case” object, field with label as “Contact name” and API name as “ContactId” has data type listed as “Lookup”).
Field | Description |
---|---|
SOQL query body | Use the Salesforce Object Query Language (SOQL) to search your organization's Salesforce data for specific information. |
Response Mapping - Record | The exact parameter name of the Salesforce API property. Salesforce sends response to AI Studio as a json which can be used in two ways:-
|
Response Mapping - Parameter | The parameter you’d like to store the "Record" value in. You can select either a multi-value or single-value parameter, depending on the number of possible values you are expecting. |
Create a new record in Salesforce.
All fields are mandatory. Please note that the Record ID needs to be utilized when you create a record.
Field Name | Description |
---|---|
Object Name | Object names are the primary reference visible in the Salesforce user interface, for example in this case it may be "Contact" |
Field API Name | The name of the field, as used programmatically in Apex, or any of the APIs (REST, SOAP, Bulk, etc). Most standard fields use the same name as the label while custom fields will show '__c' at the end for the API Name. To learn more please visit this page. |
Value | The value can be either filled in dynamically (by entering $ followed by the parameter name) or be set. |
In SalesForce "Label" is used to display the field in the user interface in areas such as record detail pages, search results, and list views.
Saving created record IDs into parameters
You can now save the IDs of the records you create during the course of a conversation directly into a parameter in Studio.
Here's how this works:-
Once you create a record you can choose to save the object ID in a parameter from the drop down list.
Please make sure that the parameter has sys.any as its entity type and is not a multi-value parameter.
You can use this saved parameter anywhere within the conversation. It can work as both a regular custom parameter as well as a User parameter that can be used to optimise future conversations.
Update a record data in Salesforce.
All fields are mandatory.
Field Name | Description |
---|---|
Object Name | Object names are the primary reference visible in the Salesforce user interface. |
Object ID Record | The record ID is the unique identifier assigned to each record (under an object) in your Salesforce account |
Field API Name | The name of the field, as used programmatically in Apex, or any of the APIs (REST, SOAP, Bulk, etc). Most standard fields use the same name as the label while custom fields will show '__c' at the end for the API Name. To learn more please visit this page. |
Value | The value can be either filled in dynamically (by entering $ followed by the parameter name) or be set. |
Clicking on "Test Request" will also update the relevant record(s) on Salesforce.
If you want to test your Salesforce Get Data node, you can do so by clicking on "Test Request" on the top right of the node.
It will open a new window that shows you Salesforce's response to your request in a raw JSON file. Under the "Test Results" tab, it will show whether or not the parameter you assigned in Response Mapping was attributed with a value. A request can be successful but the parameter under "Test Results" remains empty. The Cause for that might be a writing error in the parameter chosen in the Response Mapping, so the value might have not been attached to the parameter.
In the example below, the query was successful, and the relevant data was withdrawn from Salesforce.
Having trouble with your request?
For error tracking, please have a look at Salesforce's detailed documentation.
Update Object: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm
Create Object: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm