If you are launching Zingtree decision trees from within Salesforce, you have the ability to update the case record from any node of your tree. Here’s a summary of how to do it:
- Make sure your Agent Script button or link is set up according to this article.
- Add a Connected App to your Salesforce.
- Add the Salesforce Object Updater app to your organization within Zingtree.
- On any node in your tree, have the app trigger to update the case.
- Any Zingtree variables that begin with sf_ will update the corresponding field in Salesforce.
Adding a Connected App in Salesforce
To set up your Salesforce Connected App:
- Login into Salesforce and navigate to Setup, Create, Apps.
- Under Connected Apps, click New.
- Fill in the mandatory fields.
- Check the Enable OAuth Settings box.
- In the Callback URL field, enter this URL:
- Under Available OAuth Scopes select:
Perform requests on your behalf at any time (refresh_token, offline_access)
Access and manage your data (api)
- Your OAuth configuration should look like this when finished:
- Click Save and make a note of the generated Consumer Key and Consumer Secret. These need to be entered in the next step.
Adding the Salesforce Updater App
To add the App, do the following:
- Make sure you are logged into your Zingtree account.
- In Zingtree, go to Account, My Apps.
- Select the Salesforce Object Updater app.
- Enter your Consumer Key and Consumer Secret from the previous task.
- Allow access to your Salesforce account. (You may need to log into the account first.)
The Salesforce: Object Updater App will now appear in the list of Apps in My Apps.
Triggering a Salesforce Object Update
Once the App is installed in your organization, you can trigger a Salesforce update from any node in your tree.
- Edit the node in Zingtree where you want the update to occur. When this node is reached by an end user, the updater app will trigger.
- Under Apps/Webhooks, select your new app Salesforce: Object Updater.
- Click Save Changes.
If you are updating a Custom Object type, make sure the name of the custom object type is in the Message part of the App/Webhook call. So if you have a custom object called Medical Record, you would set up the webhook call like this:
Setting up Variable Names
As a part of your Zingtree session, you can collect data variables. Any variable that starts with sf_ will be used to update the corresponding field in Salesforce. For example, if you have a Salesforce field named description, a Zingtree variable named sf_description will be used to update that field.
Adding a Session Transcript
To include the Q&A history of the Zingtree session in a case field, you need to add a special field named Zingtree_Transcript to your Salesforce object. Here’s how to do it for Cases.
- Go To Setup, Build, Customize, Cases, Fields.
- Scroll down to Case Custom Fields, and add a new field.
- The Data Type should be Text Area (Long). Click Next.
- The Field Name must be Zingtree_Transcript. Other parameters are your choice. See this example:
Enter the other parameters, then click Next.
- Make the field read-only for all users, then click Next.
- Pick the Case Layouts where this information will be displayed, then click Save.
In case things aren’t working as you expect, here’s what to look out for:
- Changes to your case may not be reflected right away. Sometimes reloading the case (refreshing the page) will show the updates.
- If a Zingtree variable starting with sf_ has no field name counterpart in Salesforce, then the update will fail.
- You can check the Zingtree Event Log (Account, Event Log) to see all operations with Salesforce. This will show successes and failed updates, with error messages in case of failure.
- If you get a “Requested Resource Does Not Exist” message when trying to update a custom object, make sure the name of the custom object type is in the Message Data part of the App/Webhook call. So if you have a custom object called Medical_Record, you would add Medical_Record__c to the Message Data in the webhook call, like this: