Transform Template Examples
Transform functions transform input data by using Field Mappings values, and then execute custom Transform Operations, if specified. If no operation is specified, the Action is executed on the Mapping Object for the transformed record.
Typical Transform Template
A transform template record might have the following Field Mappings values:
{
"io_external_id": "Id",
"io_uuid": "Id",
"io_username": "Username",
"io_description": "'here is the description'",
"io_email": "Email",
"io_last_name": "LastName",
"io_first_name": "ifelse(FirstName, FirstName, Name)",
"io_password": "literal('ServiceMax')"
}
The following example is typical input data to be transformed:
[
{
"attributes": {
"type": "User",
"url": "/services/data/v41.0/sobjects/User/005f4000002EFdwAAG"
},
"Id": "005f4000002EFdwAAG",
"ProfileId": "00ef4000001YYRDAA4",
"Name": "Charles Miller",
"FirstName": "Charles",
"LastName": "Miller",
"Email": "charles.miller@example.com",
"Username": "cm.f7qnv0kfvfib@1903servicemaxtrial.com",
"IsActive": true
},
{
"attributes": {
"type": "User",
"url": "/services/data/v41.0/sobjects/User/005f4000002EFe4AAG"
},
"Id": "115f4000002EFe4AAG",
"ProfileId": "00ef4000001YYRDAA4",
"Name": "Tim Taylor",
"FirstName": null,
"LastName": "Taylor",
"Email": "demo@example.com",
"Username": "technicianpartner.vzqszmcglktq@1903servicemaxtrial.com",
"IsActive": true
}
]
Following is the transformed data:
[
{
"io_external_id": "005f4000002EFdwAAG",
"io_uuid": "005f4000002EFdwAAG",
"io_username": "cm.f7qnv0kfvfib@1903servicemaxtrial.com",
"io_description": "here is the description",
"io_email": "charles.miller@example.com",
"io_last_name": "Miller",
"io_first_name": "Charles",
"io_password": "ServiceMax"
},
{
"io_external_id": "115f4000002EFe4AAG",
"io_uuid": "115f4000002EFe4AAG",
"io_username": "technicianpartner.vzqszmcglktq@1903servicemaxtrial.com",
"io_description": "here is the description",
"io_email": "demo@example.com",
"io_last_name": "Taylor",
"io_first_name": "Tim Taylor",
"io_password": "ServiceMax"
}
]
Transform Function Logic
During data transformation, calculations and format conversions are implemented with transform functions. The Max platform provides a set of default functions, and you can also configure your own functions.
The previous examples use the ifelse and literal functions. Following is a typical implementation:
def literal = {val -> val.toString()}def ifelse = {condition, a, b ->
if (Boolean.valueOf(condition)) {
return a
} else { return b
}
}
Transform Manager Instance
Several of the APIs for the transform manager are exposed for client use. To get the transform manager instance from Groovy code, call the API:
TransformManager.getInstance()
For more information:
Was this helpful?