Salesforce Package
Latest Version | 1.0.0.0 |
Latest Release Date | 9 August 2022 |
By | Automation Studio Team |
Supports Automation Studio Versions | From 7.6 |
Description
Use this package to connect and interact with Salesforce. You can easily create, query, update, and delete Salesforce objects.
Before Using this Package
-
Sign up for Salesforce Developer Edition.
-
Create a Connected App (OAuth enabled). Your project uses the connected app to connect to Salesforce.
-
Manage access to your Connected App.
Summary of Contents
This package includes:
-
An SDK with several functions, allowing for integration with Salesforce.
-
Four custom types: Salesforce Compound Field, Salesforce Attachment Info, Salesforce Connection, and Salesforce Object
Summary of Use
-
Connect to Salesforce using the Salesforce Connection object.
-
Execute a single, or series of functions offered by the SDK, as part of your automation.
Sample Project
This Salesforce sample project implements the following workflow:
-
Connects to Salesforce using the webform login option.
(You are prompted for your login credentials by a popup window.)
-
Creates a Salesforce Account object, for which Salesforce returns an ID.
-
Disconnects from Salesforce.
To get started:
-
Download the project files here.
-
Unzip the downloaded file.
-
Copy the folder (Salesforce_sample) to any folder, for example, the folder where you store other Automation Studio projects:
%appdata%\Nice_Systems\AutomationStudio\Projects
-
Open the project in Automation Studio.
-
Start the project by clicking Start Project.
-
Run the workflow by clicking Run Workflow.
Package Types
Salesforce Connection
The Salesforce Connection type contains a single property and several functions for establishing an authenticated connection with Salesforce.
After importing the package, this type is found under Variables > > Complex variable > External Types > Imported Types.
Properties
Property |
Input Type |
Description |
---|---|---|
Is Connected | Boolean | A read-only property that indicates if a connection has been established with Salesforce. While the value is False, all functions that process Salesforce objects will fail. |
Methods

Connects to Salesforce using a specified username and password. This function sets the Is Connected property of the Salesforce Connection type to True if successful.
For security reasons, NICE strongly recommends not hard-coding passwords in your solution. Instead, the Client Credentials Management functionality should be used where credentials are stored at the server side and only accessed on use.
Parameter | Input | Description |
---|---|---|
Application Key |
Text |
The unique ID associated with your Connected App. To find the ID, in your logged-in Salesforce account, navigate to Apps > Connected Apps > Manage Connected Apps > API |
Application Secret |
Text |
The secret key associated with your Connected App. To find the key, in your logged-in Salesforce account, navigate to Apps > Connected Apps > Manage Connected Apps > API |
User Name |
Text |
Your Salesforce username. |
Password |
Text |
Your Salesforce password. |
Security Token | Text |
A unique alphanumeric code required when accessing Salesforce from outside your company's trusted IP address range. |
Endpoint URL | Text |
The Salesforce endpoint to which the authorization request is sent. https://<your-domain>.my.salesforce.com/services/oauth2/token |
Returns
Returns a Boolean value of True if the connection was successful, otherwise returns False.

Connects to Salesforce using a webform to submit username and password. This prevents username and password from being hardcoded into your project. This function sets the Is Connected property of the Salesforce Connection type to True if successful.
Parameter | Input | Description |
---|---|---|
Application Key |
Text |
The unique ID associated with your Connected App. To find the ID, in your logged-in Salesforce account, navigate to Apps > Connected Apps > Manage Connected Apps > API. |
Application Secret |
Text |
The secret key associated with your Connected App. To find the key, in your logged-in Salesforce account, navigate to Apps > Connected Apps > Manage Connected Apps > API. |
RedirectURL | Text |
The URL which fetches the webform login. |
IsSandBox | Boolean |
Indicates whether this is a sandbox environment. |
Returns
Returns a Boolean value of True if the connection was successful, otherwise returns False.

Disconnects from Salesforce.
It is recommended to always disconnect using this function when you no longer require access to Salesforce.
This function does not require any parameters, and sets the Is Connected property of the Salesforce Connection type to True if successful.
Returns
Returns a Boolean value of True if the connection was disconnected successfully, otherwise returns False.
Salesforce Object
The Salesforce Object is used to create a list of objects, which holds the result of a Salesforce query.
After importing the package, this type is found under Variables > > Complex variable > External Types > Imported Types.
Properties
Property |
Input Type |
Description |
---|---|---|
Attributes | List of Key-Value Pair | A list of the object's attributes and their corresponding values. |
Compound Fields | List of Salesforce Compound Field objects | A list of compound fields associated with the Salesforce object. For example, a physical address. |
Id | Text | The unique identifier of the Salesforce object. |
Properties | List of Key-Value Pair |
A list of the object's properties and their corresponding values. |
Raw Json | Text |
A raw JSON string containing the result returned by the query. |
Compound Field
The Salesforce Compound Field object groups together multiple elements of simple data types, such as numbers or text, to represent complex data types, such as a physical address.
After importing the package, this type is found under Variables > > Complex variable > External Types > Imported Types.
Properties
Property |
Input Type |
Description |
---|---|---|
Name | Text | The name of a compound field associated with a Salesforce object. |
Field Properties | List of Key-Value Pair | A list of the compound field's properties and their corresponding values. |
Attachment Info
Properties
The Salesforce Attachment Info object contains information regarding an attachment to a Salesforce object.
After importing the package, this type is found under Variables > > Complex variable > External Types > Imported Types.
Property |
Input Type |
Description |
---|---|---|
Attachment Id | Text | The unique identifier of the attached file. |
File Name | Text | The name of the attached file (extension type included). |
File Size | Number | The size of the file (bytes) |
Last Modified | DateTime | The date and time the file was uploaded to Salesforce. |
Package Functions
A successful connection to Salesforce is a prerequisite for using the functions that access Salesforce objects.

Executes an SOQL query.
Learn more about SOQL.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Query String |
Text |
The SOQL query. |
Returns
List of Salesforce objects

Executes an SOSL query.
Learn more about SOSL.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Query String |
Text |
The SOSL query. |
Returns
List of Salesforce objects

Creates a Salesforce object.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Properties | List of Key-Value Pair | A list of the object's properties and their corresponding values. You must provide at least the mandatory attributes in the attributes list. This varies depending on the Salesforce object. |
Returns
Returns the ID of the created object (text).

Deletes a Salesforce object.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Id | Text | The Salesforce object ID. |
Returns
Returns a Boolean value of True if the deletion was successful, otherwise returns False.

Updates a Salesforce object.
Ensure that you only provide attributes that exist in the object you are updating.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Id | Text | The unique identifier of the Salesforce object. |
Properties | List of Key-Value Pair | A list of the object's properties and their corresponding values. |
Returns
Returns a Boolean value of True if the update was successful, otherwise returns False.

Downloads an attachment associated with a Salesforce object.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Attachment Info |
Salesforce Attachment Info object |
An object containing details of the attached file. |
Save to Path | Text | The location where you wish to save the downloaded file (must specify the file name with the extension type). |
Overwrite |
Boolean |
Indicates whether the downloaded file should replace an existing file with the same name. |
Returns
Returns a Boolean value of True if the download was successful, otherwise returns False.

Downloads an attachment associated with a Salesforce object, by name.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Object Id |
Text |
The unique identifier of the Salesforce object. |
Attachment Name |
The |
The name of the attached file (extension type included). |
Save to Path | Text | The location where you wish to save the downloaded file (must specify the file name with the extension type). |
Overwrite |
Boolean |
Indicates whether the downloaded file should replace an existing file with the same name. |
Returns
Returns a Boolean value of True if the download was successful, otherwise returns False.

Retrieves information regarding the attachments associated with a Salesforce object.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Object Id |
Text |
The unique identifier of the Salesforce object. |
Returns
Returns a list of Salesforce Attachment Info objects.

Uploads an attachment to a Salesforce object.
For a list of Salesforce objects, see here.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection object that has established a connection with Salesforce. |
Attachment Object Type |
Text |
The Salesforce object type to which you are uploading an attachment. |
Attachment Object Id |
Text |
The unique identifier of the Salesforce object to which you are uploading an attachment. |
File Path |
Text |
The full file path of the attachment you are uploading. Make sure to include the file extension. |
Returns
Returns a Boolean value of True if the upload was successful, otherwise returns False.