Article Quick Links:
- Check Salesforce Case
- Create Salesforce Case
- Create Salesforce Lead
- How to Find Field Names in Salesforce
The Salesforce block allows you to do the following actions in Salesforce, all through your bot:
- Check a Case: Recall specific case information and share with a live chatter
- Create a Case: Seamlessly populate case fields in Salesforce with conversation content
- Create a Lead: Build out detailed leads with information collected from a chat
Before you set up your Salesforce Block, you will need to configure a Salesforce user with the appropriate credentials and add API permissions. To do so, please see this article.
Check Salesforce Case
This option helps you seamlessly look-up and provide information from a Salesforce case during an interaction with a chatter.
Action: Click on the drop-down titled Select Action, and choose Check Case.
Body Content: The Body content field helps you search your Salesforce instance. The parameter on the left is a field name in Salesforce, such as Email. The parameter on the right is the value that you are searching for, such as an email address. The block will return the first object found in your Salesforce instance that matches all of these fields.
We recommend including a field in your search that will ensure that chatters can’t retrieve information from other, non-related cases. For example, if you have an identifying field in your Salesforce instance such as CaseNumber, add it as the parameter name, and then include a variable containing the case number as the value. This would mean that only Case records would be returned that contain a CaseNumber field that matched that variable.
To learn how to find your Salesforce field names, click here.
Response: The Show Schema button will allow you to see the data returned and makes it easier to map results to variables.
Error Answer: Under Error Answer, click Choose an Answer, and select a pre-created answer. If the case look-up fails, this will be surfaced.
Now, go back to the Response field, and click Show Schema. In the returns, you should see a variety of Variable options highlighted in blue with plus buttons next to them.
Save as Variable: Choose a Variable such as Case Number, and click on it to add it to the Variable field. Set as a Local Variable, while ensuring the type is set to Text. Click the blue Save button to save.
Data Key: This field should mirror the variable you chose. For instance, if you selected Case Number, it should read: CaseNumber
In a text content block below the Salesforce block, add in a sentence such as “Great, your tracking number is” and insert the local CaseNumber variable here.
Remember to click the blue Save button when you’ve completed your Answer.
Create a Salesforce Case
To create a Salesforce case, drag the Salesforce block into your Answer and follow the below configuration set up.
Action: Click on the drop-down titled Select Action, and choose Create Case.
Body Content: Each entry in Body Content allows you to set fields on the case object in Salesforce. These field values can use variables and static text. In this example, a case will be created with email, name, along with additional custom fields.
Set the body content format to JSON. Next, click the green plus button. In the rows below that populate, set up your case fields with a Key and a corresponding Value.
For instructions on how to find Salesforce field names, see below.
Create a Salesforce Lead
Action: Click on the drop down bar that reads Select Action, and choose Create Lead
Body Content: Each entry in the Body Content allows you to set fields on the Lead object in Salesforce. These field values can use variables and static text. If you need to know the field names to use in your Salesforce instance, talk to your Salesforce administrator
Response: This button will allow you to see the data that is returned, and makes it easier to map results to variables.
Error Answer: If the creation fails, the conversation will be redirected to this answer.
Save as Variable: Lead creation will allow you to save the ID of the newly created lead into a variable, by putting the text ID in the Data Key and specifying the variable it will be saved in.
How to Find Field Names in Salesforce
To find the field names in your Salesforce instance:
- Click on the gear icon in the upper right hand corner of your Salesforce dashboard, and select Setup from the menu.
- In the Quick Find search field at the top of the left hand menu, search for object manager.
- To find field names, select fields and relationships and search for the fields in question.