Skip to main content

Version: 19.11 (EOL)

Traversing JSON properties

Instead of storing values in multiple Journey Manager Txn properties, you can also store values on a single property in a JSON object and use them in Workspaces.

Example

Let's see how we can modify the following example:

Txn properties
{
"Applicants.PrimaryType": "Primary",
"Applicants.PrimaryEmail": "[email protected]",
"Applicants.PrimaryName": "David Gilmore",
"Applicants.PrimarySSN": "122-313-3443",
"Applicants.SecondaryType": "Secondary",
"Applicants.SecondaryEmail": "[email protected]",
"Applicants.SecondaryName": "Matt Green",
"Applicants.SecondarySSN": "111-233-1234"
}
Global mappings config
{
"$primaryType": {
"label": "Type",
"dataIndex": "properties['Applicants.PrimaryType']",
"type": "text"
},
"$primaryName": {
"label": "Name",
"dataIndex": "properties['Applicants.PrimaryName']",
"type": "text"
},
"$primaryEmail": {
"label": "Email",
"dataIndex": "properties['Applicants.PrimaryEmail']",
"type": "text"
},
"$primarySSN": {
"label": "SSN",
"dataIndex": "properties['Applicants.PrimarySSN']",
"type": "text"
},
"$secondaryType": {
"label": "Type",
"dataIndex": "properties['Applicants.SecondaryType']",
"type": "text"
},
"$secondaryName": {
"label": "Name",
"dataIndex": "properties['Applicants.SecondaryName']",
"type": "text"
},
"$secondaryEmail": {
"label": "Email",
"dataIndex": "properties['Applicants.SecondaryEmail']",
"type": "text"
},
"$secondarySSN": {
"label": "SSN",
"dataIndex": "properties['Applicants.SecondarySSN']",
"type": "text"
}
}
Custom Cards config
{
"customCards": [
{
"label": "Primary",
"icon": "PermIdentityTwoTone",
"type": "list",
"properties": [
"$primaryType",
"$primaryEmail",
"$primaryEmail",
"$primarySSN"
]
},
{
"label": "Secondary",
"icon": "PermIdentityTwoTone",
"type": "list",
"properties": [
"$secondaryType",
"$secondaryName",
"$secondaryEmail",
"$secondarySSN"
]
}
]
}

The example above can become more complex when adding more applicant properties on the Txn properties, but this can be improved by changing the way we store the "Applicants" information into a single JSON property.

Refactored Txn properties
{
"Applicants": "[{\"type\":\"Primary\",\"email\":\"[email protected]\",\"name\":\"David Gilmore\",\"ssn\":\"122-313-3443\"},{\"type\":\"Secondary\",\"email\":\"[email protected]\",\"name\":\"Matt Green\",\"ssn\":\"111-233-1234\"}]"
}

Using the dataSource attribute, we can tell Workspaces to look for child attributes inside a JSON property in the Txn.

Refactored Global mappings config
{
"$applicants": {
"label": "Applicants",
"icon": "PermIdentityTwoTone",
"type": "tableExtended",
"dataSource": "properties['Applicants']",
"properties": [
{
"label": "Role",
"dataIndex": "type",
"type": "text"
},
{
"label": "Name",
"dataIndex": "name",
"type": "text"
},
{
"label": "Email",
"dataIndex": "email",
"type": "text"
}
],
"sections": [
{
"label": "Personal Info",
"type": "list",
"properties": [
{
"label": "Name",
"dataIndex": "name",
"type": "text",
"fullWidth": true
},
{
"label": "SSN",
"dataIndex": "ssn",
"type": "text"
},
{
"label": "Email",
"dataIndex": "email",
"type": "text"
}
]
}
]
}
}
Refactored Applicants config
{
"customCards": ["$applicants"]
}

The example above demonstrates how the new tableExtended Custom Card can be used to simplify mappings configuration and group values in a single Txn property. tableExtended is a new custom card type supported in Custom Card configurations starting from Workspaces 19.11.

In this topic