Salesforce
Salesforce Pack.#
This Integration is part of the
Overview
Use the Salesforce integration to search, query, and add new objects (tasks, accounts, cases, and so on) to Salesforce directly from Cortex XSOAR.
The fetch incident option enables you to monitor the creation of new Salesforce cases and manage them in Cortex XSOAR.
Use cases
Search for data: !salesforce-search pattern=”1234”
This command will return all relevant objects containing the string 1234 as a part of their data.
Querying the data base: !salesforce-query query=“SELECT Subject,Description FROM User WHERE CreatedDate>2018-01-01T00:00:00Z”
This command will return the subject and description of all cases that were created in 2018.
Creating Cases: !salesforce-add-case status="On Hold" subject="adding case from command add-case" type="Feature Request" priority=Low
This command will create a new Salesforce case with the given data.
Submitting Chatter message: !salesforce-push-comment oid=5003600000Smg4sAAB text="adding comment to case" link="google.com"
This command will add a new comment to the object oid and result with the following comment.
Configure Salesforce to Work with Cortex XSOAR
- Add a new connected App in Salesforce. For more information, see the Salesforce documentation .
- If you already have a connected App, navigate to Setup > App Manager and select the correct App from the list, and click View .
-
You can find the Consumer Key / Secret under
API (Enable OAuth Settings).
For detailed instructions see the Credentials walkthrough section.
Configure the Salesforce Integration on Cortex XSOAR
- Navigate to Settings > Integrations > Servers `&` Services .
- Search for Salesforce.
-
Click
Add instance
to create and configure a new integration instance.
- Name : a textual name for the integration instance.
- Instance URL : A URL to the instance.
- Credentials : The username for accessing the instance
- Consumer Key : The Consumer Key set for this integration with Cortex XSOAR, as explained in 'Setting Salesforce'
- Consumer Secret : The Consumer Secret set for this integration with Cortex XSOAR, as explained in 'Setting Salesforce' above.
- Trust any certificate (not secure)
- Fetch type: cases/comments (Only fetch comments when using the SalesforceAskUser automation)
- Use system proxy settings
- Fetch incidents
- Incident type
- Click Test to validate the URLs, token, and connection.
Fetched Incidents Data
The fetch command monitors the creation of new cases starting from the time the option was enabled.
Commands
You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.
- Search Salesforce records: salesforce-search
- Perform a query using SOQL: salesforce-query
- Get an object: salesforce-get-object
- Update an object: salesforce-update-object
- Create an object: salesforce-create-object
- Add a comment to chatter: salesforce-push-comment
- Get case information: salesforce-get-case
- Create a case: salesforce-create-case
- Update a case: salesforce-update-case
- Get all cases: salesforce-get-cases
- Close a case: salesforce-close-case
- Add a comment to a chatter thread: salesforce-push-comment-threads
- Delete a case: salesforce-delete-case
1. Search Salesforce records
Search records that contain values with pattern.
Base Command
salesforce-search
Input
Argument Name | Description | Required |
---|---|---|
pattern | String or number to search | Required |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time the case was created |
SalesForce.Case.ClosedDate | date | Time the case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Case priority (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
SalesForce.Contact.ID | string | Contact ID |
SalesForce.Contact.Name | string | Contact name |
SalesForce.Contact.Account | string | Account associated with the contact information |
SalesForce.Contact.Title | string | Contact title |
SalesForce.Contact.Phone | string | Contact phone number |
SalesForce.Contact.MobliePhone | string | Contact mobile number |
SalesForce.Contact.Email | string | Contact email address |
SalesForce.Contact.Owner | string | Contact owner |
SalesForce.Lead.ID | string | Lead ID |
SalesForce.Lead.Name | string | Lead name |
SalesForce.Lead.Title | string | Lead title |
SalesForce.Lead.Company | string | Lead company |
SalesForce.Lead.Phone | string | Lead phone number |
SalesForce.Lead.Mobile | string | Lead mobile number |
SalesForce.Lead.Email | string | Lead email address |
SalesForce.Lead.Owner | string | Lead owner |
SalesForce.Lead.Status | string | Lead status (New, Nurturing, Working, Qualified, or Unqualified) |
SalesForce.Task.ID | string | Task ID |
SalesForce.Task.Subject | string | Task subject |
SalesForce.Task.Lead | string | Task leader |
SalesForce.Task.RelatedTo | string | Relevant account |
SalesForce.Task.DueDate | date | Task due date |
SalesForce.User.ID | string | User's ID |
SalesForce.User.Name | string | User's name |
SalesForce.User.Title | string | User's title |
SalesForce.User.Phone | string | User's phone number |
SalesForce.User.Email | string | User's email address |
2. Perform a query using SOQL
Query Salesforce with SOQL
Base Command
salesforce-query
Input
Argument Name | Description | Required |
---|---|---|
query | Query in SOQL format: "SELECT name from Account" | Required |
Context Output
There is no context output for this command.
Command Example
3. Get an object
Get object by path
Base Command
salesforce-get-object
Input
Argument Name | Description | Required |
---|---|---|
path | Object path, for example: "Case/5000Y000001EjzRQAS" for Object "Case" with ID "5000Y000001EjzRQAS" | Required |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time the case was created |
SalesForce.Case.ClosedDate | date | Time the case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Case priority (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
SalesForce.Contact.ID | string | Contact ID |
SalesForce.Contact.Name | string | Contact name |
SalesForce.Contact.Account | string | Account associated with the contact information |
SalesForce.Contact.Title | string | Contact title |
SalesForce.Contact.Phone | string | Contact phone number |
SalesForce.Contact.MobliePhone | string | Contact mobile number |
SalesForce.Contact.Email | string | Contact email address |
SalesForce.Contact.Owner | string | Contact owner |
SalesForce.Lead.ID | string | Lead ID |
SalesForce.Lead.Name | string | Lead name |
SalesForce.Lead.Title | string | Lead title |
SalesForce.Lead.Company | string | Lead company |
SalesForce.Lead.Phone | string | Lead phone number |
SalesForce.Lead.Mobile | string | Lead mobile number |
SalesForce.Lead.Email | string | Lead email address |
SalesForce.Lead.Owner | string | Lead owner |
SalesForce.Lead.Status | string | Lead status (New, Nurturing, Working, Qualified, or Unqualified) |
SalesForce.Task.ID | string | Task ID |
SalesForce.Task.Subject | string | Task subject |
SalesForce.Task.Lead | string | Task leader |
SalesForce.Task.RelatedTo | string | Relevant account |
SalesForce.Task.DueDate | date | Task due date |
SalesForce.User.ID | string | User ID |
SalesForce.User.Name | string | User's name |
SalesForce.User.Title | string | User's title |
SalesForce.User.Phone | string | User's phone number |
SalesForce.User.Email | string | User's email |
Command Example
Context Example
Human Readable Output
4. Update an object
Update object fields
Base Command
salesforce-update-object
Input
Argument Name | Description | Required |
---|---|---|
path | Object path, for example: "Case/5000Y000001EjzRQAS" for Object "Case" with ID "5000Y000001EjzRQAS" | Required |
json | JSON with fields and values of the object to be updated | Required |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time case was created |
SalesForce.Case.ClosedDate | date | Time case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Case priority (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
SalesForce.Contact.ID | string | Contact ID |
SalesForce.Contact.Name | string | Contact name |
SalesForce.Contact.Account | string | Account associated with the contact information |
SalesForce.Contact.Title | string | Contact title |
SalesForce.Contact.Phone | string | Contact phone number |
SalesForce.Contact.MobliePhone | string | Contact mobile number |
SalesForce.Contact.Email | string | Contact email address |
SalesForce.Contact.Owner | string | Contact owner |
SalesForce.Lead.ID | string | Lead ID |
SalesForce.Lead.Name | string | Lead name |
SalesForce.Lead.Title | string | Lead title |
SalesForce.Lead.Company | string | Lead company |
SalesForce.Lead.Phone | string | Lead phone number |
SalesForce.Lead.Mobile | string | Lead mobile number |
SalesForce.Lead.Email | string | Lead email address |
SalesForce.Lead.Owner | string | Lead owner |
SalesForce.Lead.Status | string | Lead status (New, Nurturing, Working, Qualified, or Unqualified) |
SalesForce.Task.ID | string | Task ID |
SalesForce.Task.Subject | string | Task subject |
SalesForce.Task.Lead | string | Task leader |
SalesForce.Task.RelatedTo | string | Relevant account |
SalesForce.Task.DueDate | date | Task due date |
SalesForce.User.ID | string | User's ID |
SalesForce.User.Name | string | User's name |
SalesForce.User.Title | string | User's title |
SalesForce.User.Phone | string | User's phone number |
SalesForce.User.Email | string | User's email |
5. Create an object
Create new object
Base Command
salesforce-create-object
Input
Argument Name | Description | Required |
---|---|---|
path | Object path, for example: "Case" for Object "Case" | Required |
json | JSON with fields and values of the object to be created | Required |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time case was created |
SalesForce.Case.ClosedDate | date | Time case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Case priority (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
SalesForce.Contact.ID | string | Contact ID |
SalesForce.Contact.Name | string | Contact name |
SalesForce.Contact.Account | string | Account associated with the contact information |
SalesForce.Contact.Title | string | Contact title |
SalesForce.Contact.Phone | string | Contact phone number |
SalesForce.Contact.MobliePhone | string | Contact mobile number |
SalesForce.Contact.Email | string | Contact email |
SalesForce.Contact.Owner | string | Contact owner |
SalesForce.Lead.ID | string | Lead ID |
SalesForce.Lead.Name | string | Lead name |
SalesForce.Lead.Title | string | Lead title |
SalesForce.Lead.Company | string | Lead company |
SalesForce.Lead.Phone | string | Lead phone number |
SalesForce.Lead.Mobile | string | Lead mobile number |
SalesForce.Lead.Email | string | Lead email |
SalesForce.Lead.Owner | string | Lead owner |
SalesForce.Lead.Status | string | Lead status (New, Nurturing, Working, Qualified, or Unqualified) |
SalesForce.Task.ID | string | Task ID |
SalesForce.Task.Subject | string | Task subject |
SalesForce.Task.Lead | string | Task leader |
SalesForce.Task.RelatedTo | string | Relevant account |
SalesForce.Task.DueDate | date | Task due date |
SalesForce.User.ID | string | User's ID |
SalesForce.User.Name | string | User's name |
SalesForce.User.Title | string | User's title |
SalesForce.User.Phone | string | User's hone number |
SalesForce.User.Email | string | User's email address |
6. Add a comment to chatter
Add a comment to chatter
Base Command
salesforce-push-comment
Input
Argument Name | Description | Required |
---|---|---|
oid | Object ID of subject | Required |
text | Chat text | Required |
link | Add a link to the message | Optional |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Comment.Body | string | Comment body |
SalesForce.Comment.CreatedDate | date | Comment created date |
SalesForce.Comment.Title | string | Comment title |
SalesForce.Comment.ParentType | string | Comment parent type |
SalesForce.Comment.ParentName | string | Comment parent name |
SalesForce.Comment.URL | string | Comment URL link |
SalesForce.Comment.Visibility | string | Comment visibility |
Command Example
Context Example
7. Get case information
Get information for a specified on a case. All arguments are optional, but you must specify at least one for the command to execute successfully.
Base Command
salesforce-get-case
Input
Argument Name | Description | Required |
---|---|---|
oid | Object ID of the case | Optional |
caseNumber | Case number | Optional |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time case was created |
SalesForce.Case.ClosedDate | date | Time case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Priority of the case (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
Command Example
Context Example
8. Create a case
Create a new case
Base Command
salesforce-create-case
Input
Argument Name | Description | Required |
---|---|---|
subject | Case subject | Required |
description | Case description | Optional |
status | Case status | Required |
origin | Case origin | Optional |
priority | Case priority | Optional |
type | Case type | Optional |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time case was created |
SalesForce.Case.ClosedDate | date | Time case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Priority of the case (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason for case creation |
9. Update a case
Update case fields
Base Command
salesforce-update-case
Input
Argument Name | Description | Required |
---|---|---|
oid | Case Object ID | Optional |
caseNumber | Case number | Optional |
subject | Case subject | Optional |
description | Case description | Optional |
status | Case status | Optional |
origin | Case origin | Optional |
priority | Case priority | Optional |
type | Case type | Optional |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case number |
SalesForce.Case.Subject | string | Case subject |
SalesForce.Case.Description | string | Case description |
SalesForce.Case.CreateDate | date | Time case was created |
SalesForce.Case.ClosedDate | date | Time case was closed |
SalesForce.Case.Owner | string | Case owner |
SalesForce.Case.Priority | string | Priority of the case (Low, Medium, High) |
SalesForce.Case.Origin | string | How case originated (Web, Phone, Email) |
SalesForce.Case.Status | string | Case status (New, Escalated, On Hold, or Closed) |
SalesForce.Case.Reason | string | Reason the case was created |
10. Get all cases
Get all cases
Base Command
salesforce-get-cases
Input
There is no input for this command.
Context Output
There is no context output for this command.
11. Close a case
Close a case
Base Command
salesforce-close-case
Input
Argument Name | Description | Required |
---|---|---|
oid | Case Object ID | Optional |
caseNumber | Case Number | Optional |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Case.ID | string | Case Object ID |
SalesForce.Case.CaseNumber | string | Case Number |
SalesForce.Case.Subject | string | Case Subject |
SalesForce.Case.Description | string | Case Description |
SalesForce.Case.CreateDate | date | Creation Time of Case |
SalesForce.Case.ClosedDate | date | Closure Time of Case |
SalesForce.Case.Owner | string | Case Owner |
SalesForce.Case.Priority | string | Priority of the Case. one of Low, Medium, High. |
SalesForce.Case.Origin | string | Origin of the Case. one of Web, Phone, Email. |
SalesForce.Case.Status | string | Case Status. one of the following: New, Escalated, On Hold or Closed. |
SalesForce.Case.Reason | string | Reason for case creation |
Command Example
12. Add a comment to a chatter thread
Add the comment to the chatter thread. Use this command only after salesforce-push-comment
Base Command
salesforce-push-comment-threads
Input
Argument Name | Description | Required |
---|---|---|
id | The Chatter comment Thread ID | Required |
text | The comment text | Required |
Context Output
Path | Type | Description |
---|---|---|
SalesForce.Comment.Reply.Body | string | Reply body |
SalesForce.Comment.Reply.CreatedDate | date | Reply created date |
SalesForce.Comment.Reply.URL | string | Reply URL link |
13. Delete a case
Delete a specified on a case. All arguments are optional, but you must specify at least one for the command to execute successfully.
Base Command
salesforce-get-case
Input
Argument Name | Description | Required |
---|---|---|
oid | Object ID of the case | Optional |
caseNumber | Case number | Optional |
Troubleshooting
Connection error :
-
This error indicates that there is a problem with the credentials or the IP connection to the app (see step 6-7 in Credentials walkthrough below).
-
This error indicates a problem in the Costumer Key:
-
This error indicates a problem in the Costumer Secret:
Credentials walkthrough:
1. Open
Setup
.
2. Go to the App manager on the left side menu (use Quick Find for faster search).
3. Click “New Connected App” on the right side of the screen.
4. Fill in the form as follows:
- Mark “ Enable OAuth Settings ”.
-
In “
Selected OAuth Scopes
”, Add the following:
- Access and manage your Chatter data (chatter_api)
- Access and manage your data (api)
5. Click “Save” at the bottom of the form.
6. In the information page on the APP that you will be forwarded to locate “ API (Enable OAuth Settings) ” and copy the consumer key and secret to the integration instance configuration.
6. Go to “Manage Connected Apps”.
7. Edit the new application and under “OAuth Policies” enable all IP address.
### salesforce-get-casecomment *** Returns a comment through the case number. #### Base Command `salesforce-get-casecomment` #### Input | **Argument Name** | **Description** | **Required** | | --- | --- | --- | | oid | Returns information of a case. | Optional | | caseNumber | The case number of the case. | Optional | #### Context Output | **Path** | **Type** | **Description** | | --- | --- | --- | | ID | string | The ID of the case. | | ParentId | string | The ID of the parent case of the case comment. Required. | | IsPublished | boolean | Whether the case comment is visible to customers in the Self-Service portal \(true\). The label is published. This is the only CaseComment field that can be updated through the API. | | CommentBody | string | The text of the case body. Maximum size is 4,000 bytes. The label is Body. | | CreatedById | unknown | The created date by ID. | | CreatedDate | string | The created date. | | SystemModstamp | string | The SystemMod stamp. | | LastModifiedDate | string | The last modified date. | | LastModifiedById | string | The last modified date by ID. | | IsDeleted | boolean | Whether the object has been moved to the Recycle Bin \(true\). Label is Deleted. | ### salesforce-post-casecomment *** The post comment through the case number. #### Base Command `salesforce-post-casecomment` #### Input | **Argument Name** | **Description** | **Required** | | --- | --- | --- | | oid | The Object ID of the case. | Optional | | caseNumber | The case number of the case. | Optional | | text | Added Text to context. | Optional | #### Context Output There is no context output for this command. ### salesforce-get-user *** Returns the UserName through the case number. #### Base Command `salesforce-get-user` #### Input | **Argument Name** | **Description** | **Required** | | --- | --- | --- | | oid | The Object ID of the case. | Optional | | caseNumber | The case number of the case. | Optional | #### Context Output | **Path** | **Type** | **Description** | | --- | --- | --- | | ID | string | The ID of the case. | | Alias | string | The user’s alias. Required. For example, jsmith. | | CommunityNickname | string | The name used to identify the user in the Community application, which includes the ideas and answers features. | | CreatedById | string | Created by the ID. | | Email | string | The user’s email address. Required. | | LastLoginDate | string | The time and date when the user last successfully logged in. This value is updated if 60 seconds have elapsed since the user’s last login. | | LastModifiedDate | string | The last modified date. | | LastName | string | The user’s last name. Required. | | Name | string | Concatenation of FirstName and LastName. Limited to 121 characters. | | Username | string | Contains the name that a user enters to log in to the API or the user interface. Required. Must be in the form of an email address, all characters should be lowercase, and unique across all organizations. Each added user counts as a license. Every organization has a maximum number of licenses. If you attempt to exceed the maximum number of licenses by inserting user records, the attempt to create a user is rejected. | | UserRoleId | string | The ID of the user’s UserRole. Label is Role ID. | ### salesforce-get-org *** Returns organization details from the case number. #### Base Command `salesforce-get-org` #### Input | **Argument Name** | **Description** | **Required** | | --- | --- | --- | | caseNumber | The case number of the case. | Optional | #### Context Output | **Path** | **Type** | **Description** | | --- | --- | --- | | ID | string | The unique ID of the case. | | Name | string | Name of the account. Required. Label is Account Name. Maximum size is 255 characters. If the account has a record type of Person Account, this value is the concatenation of the FirstName, MiddleName, LastName, and Suffix of the associated person contact. You cannot modify this value. |