Creating a case in Salesforce.

 

 

Overview

During the lifecycle of an interaction with a customer, partner, or even employee, you reach a point where you need to open a case in Salesforce. This can be to track a conversation, log an enhancement request, or log a support issue. Depending on your business rules, you might want to create the case as an automated process.  In this tutorial, we will discuss how to automate case creation as part of an Atmosphere® SmartFlow.

 

Building on the past

If you have been following our tutorials, you are going to find that this one is actually a continuation of something you may have already built. We are going to start with the tutorial we built for looking up contact in Salesforce.

If you are unfamiliar with building Smartflows in Atmosphere, or just need a refresher, we recommend that you start with a review of our quick start tutorial: https://www.intelepeer.com/products/documentation/salesforce-customer-lookup/

 

 

Lets look at how we created this flow.

Imitation is the sincerest form of flattery

To help save us some time, we are going to copy our previous work.

From your previous Smartflow, click on the button labeled Clone

This is going to create a copy of your flow. Update the name of the new flow to something that makes and click Save.

Case Requirements

The Required fields to open a case and the values to be used to fill in the fields can vary by Salesforce Instance. Consult your Salesforce Administrator to determine what information is required.

Once you have determined which values are required, you need to determine how you wish to collect this information. We suggest creating a small matrix to help you map out the corresponding values.

For this tutorial, we are going to use populate the following fields required for a new case:  

Default Values: Fields that will have the same value each time:

Field Default Value
Type Based on department contacted Support: Incident Management Billing: Collections Customer Service: Product Inquiry  
Origin Phone
Status New
Owner Id All tickets will be assigned to our bot owner: 005G0000001jrgg
Priority P3

Salesforce Provided Data: Data derived from the caller’s information:

Field Where in Salesforce is the data located.
AccountId Contact.AccountId
ContactId Contact.Id
SuppliedName Contact.Name
SuppliedEmail Contact.Email
SuppliedPhone Contact.Phone

Data I will prompt the caller for:

Field Prompt
Subject “Please provide a short description of your problem”
Description “Please describe your issue in detail”

Gather Your Data

At this point, you will need to update your flow to collect the data you need from the caller. This tutorial will not go into detail on how to collect this information. Please see your Smartflows documentation for details on how to collect the required data using your preferred caller interface (e.g. Speech, DTMF, SMS)

For our example, all of our Salesforce supplied data will come from the work we completed in the previous tutorial. External Web Call action #5 will send a request to Salesforce to provide the necessary information based on the caller’s phone number. For the data we must prompt the caller to provide, we are going to collect this information using the Text to Speech capability of the Play Audio basic action and the Speech Recognition premium action. The text captured will be stored into variables representing our Subject and Description (txtSubject and txtDescription).

Creating your Case

Once your flow is set to collect your data, you can now create the integration to create the case. Add another EXTERNAL API CALL action to the flow:

Configure the action to include the required and any optional fields you would like to include:

Configure the action as follows:





Add Headers

Add an Authorization Header. The value of this header should include the term Bearer as well as the Access token received in Action #4. (Bearer $EXTCALL_4.access_token)

Basic Auth

UserName: Leave Blank. The access token takes care of this for you

Password: Leave Blank. The access token takes care of this for you

Method: Set this to POST

Timeout: The default is 10 seconds. This should be fine for your instance.

URL Of Service: Set this to the url of your Salesforce Instance.

https://<Your Instance Name>.my.salesforce.com/services/data/v39.0/sobjects/Case

Body

The body should contain all of the required and optional field name /value pairs you wish to provide.

Response Variables

Results will be returned in the following format:

Add the following response variable entries

Id: This will contain the id of the case created

Success: Contains a Boolean value indicating if the operation completed successfully

Errors: Contains an array of errors returned from the system.

 

For more information on the Salesforce’s Case Creation API, please visit the following Salesforce documentation: https://developer.salesforce.com/docs/api-explorer/sobject/Case/post-case/try

Continue Your Flow

Congratulations, you can now create a case from within your Smartflow.  From here you would continue your flow. This might include thanking the user to reading back the case id to the user. From here you would continue developing your flow to match your required business flow.