You are here:
Extract Data from Three Related Objects
Create an Omnistudio Data Mapper Extract for use by a Case-handling Omniscript. The agents who handle Cases can look up an Account, list all the Cases for the Account, and find the Contact for each Case.
In this example, it’s important to specify the complete object hierarchy in Extraction Object Path, filters, and Extract JSON Path values. Accounts and Contacts are directly related and these objects are related through Cases. This example uses the latter relationship. The object hierarchy tells the Data Mapper which relationship to use.
Create Settings
| Field | value | notes |
|---|---|---|
| Interface Type | Extract | |
| Input Type | JSON | If using with another Omnistudio component such as an Omniscript, set the input as JSON. |
| Output Type | JSON |
Extract Settings
Map the extracted objects with the paths in the JSON, and create a filter for the ID.
| Extraction Object | Extract Object Path | Filter |
|---|---|---|
| Account | Account | Id = AccountId |
| Case | Account:Case | AccountId = Account:Id |
| Contact | Account:Case:Contact | Id = Account:Case:ContactId |
Mapping Settings
Map the input fields from the extraction step JSON to the output JSON so that an Omniscript (or other component) can access the data. To define a data transformation, you can add key-value pairs. This addition replaces the defined key with the value in the output.
| Extract JSON Path | JSON Output Path | notes |
|---|---|---|
| Account:Name | Account:Name | Choose a data type for the data type, such as string. If needed, you can set a default value. |
| Account:Case:CaseNumber | Account:Case:CaseNumber | |
| Account:Case:Subject | Account:Case:Subject | |
| Account:Case:Contact:Name | Account:Case:Contact:Name |
Verify the Current JSON Output panel displays a desired JSON structure, as in this example.
{
"Account": {
"Case": {
"CaseNumber": "Text",
"Contact": {
"Name": "Text"
},
"Subject": "Text"
},
"Name": "Text"
}
}The order of fields in not important, but the structure is.
Extract Preview
In Preview, add AccountId as the key and a valid Salesforce Account object ID as the value, such as 0015e000003XlkMAAS.
After you execute the sample Data Mapper in Preview, the desired output with the associated cases is shown, such as this example.
{
"Account": {
"Case": [
{
"Contact": {
"Name": "Edward Stamos"
},
"Subject": "Cannot track our order",
"CaseNumber": "00001004"
},
{
"Contact": {
"Name": "Leanne Tomlin"
},
"Subject": "Wrong size widgets",
"CaseNumber": "00001003"
},
{
"Contact": {
"Name": "Jeff Hunt"
},
"Subject": "Update account phone number",
"CaseNumber": "00001005"
},
{
"Contact": {
"Name": "Edward Stamos"
},
"Subject": "Billing status",
"CaseNumber": "00001006"
}
],
"Name": "Acme"
}
}

