If the source system's API changes or you add custom data, you might have to create custom mapping fields.
To create a custom field, open the mapping page for the integration, and click Add integration field
.
The character limit for field paths is 256 characters. Exceeding this limit will cause the integration to fail.
Ensure that there are no spaces separating Jinja statements and that all elements of the statement are on a single line.
Custom field mapping
You can create your own custom fields by accessing the {{response}}
object. The {{response}}
object stores the response body and can be accessed by appending the JSON path to the {{response}}
value, for example, {{response.field_name}}
. The response value can be enclosed in double curly brackets.
To access nested fields use dot or bracket notation such as {{response.profile["field_name"]}}
or {{response.profile.field_name}}
.
For example, if the source system provides the following data:
{
"profile": {
"first_name": "Helen",
"last_name": "Troy"
},
"status": "Active"
}
You can access first_name
using the following formula:
{{response.profile.first_name}}
{{response.profile["first_name"]}}
To access the last_name
you use:
{{response.profile.last_name}}
{{response.profile["last_name"]}}
.
And to retrieve the status
value use:
{{response.status}}
{{response["status"]}}
Mapping fields that use escaped characters
If a response key contains an escaped character such as a hyphen, dot, or space, you must use bracket notation in Jinja. This is to avoid these characters being misinterpreted as minus operators, nested values, or delimiters. For example, a key that is named test-field would be accessed as {{response['test-field']}}
, assigned_to.email as {{response['assigned_to.email']}}
, and first name as {{response['first
name']}}
.
Escaped fields examples
Escaped characters in integration fields | Mapped to | Values displayed in records |
Space 'test field' |
test_SPACE_field | Test Field |
Dot 'test.field' |
test_DOT_field | Test Field |
Hyphen 'test-field' |
test_DASH_field
|
Test Field |
Important
The test-field is only mapped to test_DASH_field when the response, {{response['test-field']}}
, cannot be used.
See List of characters that are escaped in integrations and workflows.
Hardcode values
The Add new field feature is also very useful for hardcoding certain values on the Oomnitza side. In the example below, a new field called Role is created and the default value is hardcoded as {{"Employee"}}.
This new field can then be mapped to an Oomnitza field.
Finally, click Edit integration and add a rule to update the field in Oomnitza if it is empty.
This example can be used for user integrations to create an Employee role for new users in Oomnitza only. That is, users in Oomnitza where the Role field is empty.
Concatenate values
{{GetUserResponse.GetUserResult.User.UserName}}@mycompanydomain.com
prepends the username to @mycompanydomain.com
(where mycompanydomain
is the name of the company). This field can then be mapped to Oomnitza and will create the email when the integration is run. Custom Jinja code
You can also use the Add new field feature to add Jinja2 templates in order to transform the data that is retrieved when Oomnitza syncs with the vendor application. For example, the following Jinja code can be used to set the Last Sync Time to the current date and time.
{% set datetime = import('datetime') %} {% set now= datetime.datetime.utcnow() %} {{now}}
Comments
0 comments
Please sign in to leave a comment.