Build Simple Integration Procedures
Learning Objectives
After completing this unit, you’ll be able to:
- Describe where Integration Procedures fit within the data flow.
- Build a simple Integration Procedure to get data for an OmniScript.
- Build a simple Integration Procedure to save updated data to Salesforce.
Where Integration Procedures Fit Within the Data Flow
In the previous unit, you designed a few Integration Procedures based on scenarios. In this unit, you will build an Integration Procedure that passes data from the Account object to an Edit Account OmniScript. Then, you will build another Integration Procedure that saves this data that was added or changed in the OmniScript back to the Account object.
First, let’s see where an Integration Procedure fits in the data flow for this scenario.
- When the Edit Account OmniScript launches from an action on a FlexCard, it passes the RecordId for the account (called the AccountId) from a JSON node to a Data Mapper Extract.
- The Edit Account OmniScript saves this RecordId in a variable called ContextId. AccountId is an arbitrary name for the RecordId, which means you can call the RecordId anything you like; however, the name must be the same in each of the elements for the data to flow properly between them and Salesforce. It’s best practice to label the ContextId with a description of what kind of ID it is.
- The OmniScript passes a variable called AccountId to an Integration Procedure, which passes the AccountId to a Data Mapper Extract.
- The Data Mapper Extract uses the AccountId in Salesforce Object Query Language (SOQL) to retrieve data from Salesforce. This includes not only the AccountId but also data from the Account record. The Data Mapper Extract sends the data, in JavaScript Object Notation (JSON) format, back to the Integration Procedure and then to the OmniScript.
- The user and other OmniScript actions manipulate the data.
- An updated data JSON, including the AccountId, is then passed to an Integration Procedure, which passes it to a Data Mapper Load.
- The Data Mapper Load uses the AccountId to identify the original account record and updates the data in Salesforce.
Build an Integration Procedure to Get Data
In scenario 1 in the previous unit, you designed the Integration Procedure to get data for the Edit Account OmniScript. You chose the Data Mapper Turbo Extract Action to call a Data Mapper Turbo Extract to get Account data from Salesforce. Then you chose the Response Action to send that data back to the Edit Account OmniScript from the Integration Procedure. That process looks like this.
How do you configure all this in the Integration Procedure itself?
- Drag a Data Mapper Turbo Action (1) from the Available Components panel to the Structure panel.
- Give it a name that describes its purpose, such as
DRGetAccountDetails
.
- In the Data Mapper Turbo Action’s Properties panel, select the Data Mapper Turbo Extract you want to use in the Data Mapper Interface (1) field.
- Under Input Parameters (2), enter AccountId for both the Data Source and Filter Value. Remember, AccountId is an arbitrary name for the RecordId, but it must be the same in each of the elements for the data to flow properly between them and Salesforce.
- Configure the Response Action (1) to tell the Integration Procedure what data to send back to the Edit Account OmniScript. To trim the data and return only what the OmniScript needs, enter
DRGetAccountDetails
in the Send JSON Path (2) field.
Way to go! You’ve configured the Integration Procedure, but now you want to test if it’s working. You need the RecordId of an account to do this, so let’s take a moment to explain what this is and how you find it.
All records in Salesforce have a unique RecordId. To find a RecordId for an account, simply open any Account record in your org and copy the RecordId from the URL.
Now that you have an AccountId, you’re ready to test.
On the Integration Procedure’s Preview tab, enter a Key/Value pair in the Input Parameters panel (1) such as AccountId for the Key and an Account’s RecordId for the Value.
Click Execute (2) to run the Integration Procedure. The Response pane (3) returns results to confirm it is extracting data correctly.
The Preview tab includes a Debug Log (1), which helps you to work through and identify any issues with the output and the input for each element in the Integration Procedure. To ensure the Data Mapper is connected to the Integration Procedure, select DRGetAccountDetails (2) and confirm that the Account information displays.
In the Debug Log dropdown, Original Input is what you expect to pass to the Integration Procedure. The Debug Log includes two entries for each element. NAME displays the output and NAMEDebug shows the input for the step. If you don't see expected outputs, review the debug entry to find out what is wrong with the input data.
Everything seems correct and in order, so you’re ready to activate this version of the Integration Procedure.
In the Procedure Configuration (1) element properties, click Activate Version (2).
Do a final test to confirm the Integration Procedure is working in the Edit Account OmniScript, and that the Integration Procedure is available for use in the OmniScript only if it’s active.
The Edit Account OmniScript includes Integration Procedure Actions that you can configure to link Integration Procedures to the OmniScript.
The IPGetAccountDetails Integration Procedure Action (1) shows team_getAccountDetails selected in the Integration Procedure field (2).
From the Edit Account OmniScript’s Preview tab, enter your RecordId into the Context ID field. The Preview displays data retrieved by the Integration Procedure.
Congratulations! You’ve learned how to create an Integration Procedure that gets data for an OmniScript.
The data displayed for the Website is www.acme4.com. But what if you want to change that to www.acme.com? Let’s turn our attention to an Integration Procedure that saves data from an OmniScript.
Build an Integration Procedure to Save Data
When you designed the Integration Procedure for this scenario, you chose the Data Mapper Post Action element to save updated data from the Edit Account OmniScript to Salesforce. Here’s the flow.
Let’s configure it.
- Drag a Data Mapper Post Action (1) from the Available Components panel to the Structure panel.
- Give it a name that describes its purpose, such as
DRSaveAccountDetails
(2).
In the Data Mapper Post Action’s Properties panel, select the Data Mapper Load you want to use in the Data Mapper Interface field.
Now, you need to activate this Integration Procedure to make it available for use in the Edit Account OmniScript.
Test if the Integration Procedure is working in the Edit Account OmniScript.
- In the Edit Account OmniScript, link the IPSaveAccountDetails Integration Procedure Action (1) to an Integration Procedure, in this case, the team_saveAccountDetails (2).
- From the Edit Account OmniScript’s Preview tab, enter your RecordId into the Context ID field. The Preview displays data retrieved by the first Integration Procedure you built.
- To test if the second Integration Procedure works, make a change to the data. Let’s change the www.acme4.com website to
www.acme.com
(1) and click Next (2).
- Open the Account record to confirm the data was updated successfully.
We hope you’re feeling pretty confident about your Integration Procedure skills now. Remember, if you need to get, save, and manipulate data behind the scenes, Integration Procedures are your go-to tools.