Transformation Functions
A function is a hardcoded piece of transformation logic that receives a value denoted by the input specified by a source path or a source variable. As a result, the value is replicated into the target path or target variable, accordingly.
The Identity Provisioning service uses two types of functions: conditional and mapping functions. The conditional functions are functions which can be used only in conditional statements. The mapping functions are used in entity transformations and are included as mappings.
Functions can also be chained – that means, the output of one function is the input for the next one. See an example with such functions in the encode / decode section below.
For more information, see the tables below.
Conditional Functions
|
Function |
Parameters |
Description |
|---|---|---|
|
isValidEmail |
|
This function verifies whether an e-mail address is valid by checking if the given String value matches the following regex pattern: "[a-zA-Z0-9!#$%&‘'*+/=?^_`{|}~-]+(?>\\.[a-zA-Z0-9!#$%&‘'*+/=?^_`{|}~-]+)*@(?>[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]?\\.)+[a-zA-Z0-9](?>[a-zA-Z0-9-]*[a-zA-Z0-9])?"
After the check, the function returns a Boolean result. This function can be used only as part of a conditional statement. EXAMPLE 1:
In this example, the source JSON code contains the following e-mail address of a user:
{
"userName": "test",
"emails": [
{
"value": "example@company.com",
"primary": true
}
]
}
The condition with function isValidEmail is the following: {
"condition": "isValidEmail($.emails[0].value)",
"mappings": [
{
"sourcePath": "$.userName",
"targetPath": "$.userName"
},
{
"sourcePath": "$.emails[*].value",
"preserveArrayWithSingleElement": true,
"targetPath": "$.emails[?(@.value)]"
}
]
}
EXAMPLE 2: In cases where users have multiple emails, the following condition will validate each email in the emails array: {
"condition": "isValidEmail($.emails[*].value)",
"mappings": [
{
......
|
|
isApplicationSpecificGroup |
Not applicable |
This function verifies whether a group is associated with a particular application configured in SAP Cloud Identity Services - Identity Authentication. It checks if the property ips.application.id is set for the provisioning system and whether its value matches the group attribute $['urn:ietf:params:scim:schemas:extension:sap:2.0:Group']['applicationId']. After the check, the function returns a Boolean result. This function can be used only as part of a conditional statement. The function is part of the default write transformation of some target systems (like SAP Advanced Financial Closing). |
|
isRegularGroup |
Not applicable |
This function verifies whether a group is regular user group. It checks consecutively the values of the group attributes supportedOperations and applicationId and returns a Boolean result. If one or both of the attributes are missing, the returned result is true. Otherwise, the returned value is false. This function can be used only as part of a conditional statement. The function is part of the default write transformation of some target systems (like SAP Advanced Financial Closing). |
|
isAttributeWithOptionalPrefix |
|
This function checks whether an attribute value starts with an optional prefix. The syntax used by the function is as follows: isAttributeWithOptionalPrefix(attribute-jsonpath, property-key) For example: "condition": "isAttributeWithOptionalPrefix($.displayName, s4hana.afc.group.prefix)" After the check, the function returns a Boolean result.
The returned result is true when one of the following conditions is fulfilled:
Otherwise, the returned value is false. The function is part of the default write transformation of some target systems (like SAP Advanced Financial Closing). |
|
isAttributeWithMandatoryPrefix |
|
This function checks whether an attribute value starts with a predefined mandatory prefix. The syntax used by the function is the following: isAttributeWithMandatoryPrefix(attribute-jsonpath, property-key) For example: "condition": "isAttributeWithMandatoryPrefix($.displayName, s4hana.afc.group.prefix)" After the check, the function returns a Boolean result.
The returned result is true when all of the following conditions are fulfilled:
If one or more of the conditions are not fulfilled the returned value is false. The function is part of the default write transformation of some target systems (like SAP Advanced Financial Closing). |
Mapping Functions
|
Function |
Parameters |
Description |
|---|---|---|
|
concatString |
|
This function concatenates a string with a prefix or a suffix. EXAMPLE 1: In the following transformation example, function concatString will be applied to all source logon names (SAM-account user names) read from Microsoft AD, adhering a prefix ips_ and a suffix 123 in the target system. For example, a sAMAccountName name johnsmith from the source system will be provisioned as ips_johnsmith123 in the target system. EXAMPLE 2: In the following transformation example, function concatString will be applied to all source user IDs in a source system, converting them into uniform e-mails in the Microsoft Entra ID target system. In this case, the concatString function takes the value of the aad.domain.name property (which is the name of a verified Microsoft Entra ID domain) and adheres it to the userId. For example, a source user ID johnsmith123 can produce a target principal name johnsmith123@mail.acme.com. |
|
convertCountryCode |
|
This function converts the countries into format compliant with ISO 3166-1. {
"sourcePath": "$.addresses",
"preserveArrayWithSingleElement": true,
"optional": true,
"targetPath": "$.addresses",
"functions": [
{
"type": "convertCountryCode",
"outputFormat": "alpha2",
"inputAttributes": ["country"],
"outputAttribute": "country"
}
]
}
EXAMPLE:
In the following transformation example, function convertCountryCode will be applied to all source countries read from the source system, converting them in the wanted ISO format. For example, the country name United States from the source system will be provisioned in the target system as:
|
|
convertCountryRegion |
|
This function converts the countries into format compliant with ISO 3166-2. {
"condition": "($.addresses[*].region EMPTY false) && ($.addresses[*].country EMPTY false)",
"sourcePath": "$.addresses",
"preserveArrayWithSingleElement": true,
"optional": true,
"targetPath": "$.addresses",
"functions": [
{
"type": "convertCountryRegion",
"outputFormat": "alpha2",
"inputAttributes": ["region","country"],
"outputAttribute": "region"
}
]
}
EXAMPLE:
In the following transformation example, function convertCountryRegion will be applied to all source regions read from the source system, converting them in the wanted ISO format. For example, the region name US-AL or only AL from the source system will be provisioned to the target system as:
|
|
convertLocaleCode |
|
This function converts the locale code from the source format into the format required by the target system. For example, SAP Concur (connector version 3) expects locale codes in BCP 47 format (like en-US, de-DE), while Identity Authentication (connector version 2) uses ISO 639 language codes (such as EN, DE). When converting from or to ISO 639, the function works only with the default language codes used in Identity Authentication. You can view them in the SAP Cloud Identity Services administration console under: Languages that do not have a defined mapping, such as EO (Esperanto), IA (Interlingua), IO (Interlingue), are mapped to English by default. |
|
convertTimezoneCode |
|
This function converts the value of a timezone attribute into another format, specified by the JSON modifier "outputFormat". The "outputFormat" modifier has two possible values:
The function retrieves the value of the timezone from the specified source path and searches for it within a predefined list of timezones and their corresponding world locations: Depending on the search result, you can expect the following behavior:
EXAMPLE 1: In the following transformation example, function convertTimezoneCode will be applied to the timezone attribute values from the specified source path, converting them in sap output format. For example, the time zone America/Phoenix will be provisioned as MSTNO. {
"mappings": [
{
"sourcePath": "$.timezone",
"targetPath": "$.timezone",
"functions": [
{
"type": "convertTimezoneCode",
"outputFormat": "sap"
}
]
}
]
}
EXAMPLE 2: In the following transformation example, function convertTimezoneCode will be applied to the timezone attribute values from the specified source path, converting them in iana output format. For example, the time zone AST will be provisioned as America/Halifax, which is the default value set for the relevant timezone. {
"mappings": [
{
"sourcePath": "$.timezone",
"targetPath": "$.timezone",
"functions": [
{
"type": "convertTimezoneCode",
"outputFormat": "iana"
}
]
}
]
}
|
|
compositeId |
|
This function appends the value referred by the source path to the value of the subId parameter, separated by ":". |
|
copyMapEntry |
|
This function copies a key-value pair from the source JSON and creates a similar one in the target JSON. The nelwy created pair consists of the specified targetKey String and the value copied from the initial pair. The two key-value pairs are written into the target system. EXAMPLE: For example, if the source entity contains the following roles: { "role": [{"roleName": "ROLE1"},{"roleName": "ROLE2"}] }
After applying the function: {
"sourcePath": "$.user.role",
"optional": true,
"targetPath": "$.groups",
"preserveArrayWithSingleElement": true,
"functions": [
{
"function": "copyMapEntry",
"sourceKey": "roleName",
"targetKey": "value"
}
]
}
Two pairs with targetKey "value" are added to the target JSON and the result is: { "groups":[{"roleName": "ROLE1", "value":"ROLE1"},{"roleName": "ROLE2", "value":"ROLE2"}] }
|
|
decode |
|
The function decode is part of the Write transformation of some proxy systems (like AS ABAP).It decodes the string value specified by the sourcePath or sourceVariable mapping attribute, by using specified decoding algorithm. Function result: Byte array EXAMPLE: For example, if the input JSON code contains the following user name: {
"USERNAME": "JOHN*SMITH/Junior"
}
The base32 encoded result will be the following id: {
"id": "JJHUQTRKKNGUSVCIF5FHK3TJN5ZA===="
}
The decode function reads the id and converts it into a byte array. Afterward, the toString function reads this byte array and converts it into the original USERNAME string. The base32 padding symbols (==) are skipped. |
|
elementAt |
|
This function is used to retrieve a specific element from an array based on its index. The index indicates the element you want to access. Using the elementAt function with index 0 in this example results in requesting the first email within an array of primary emails. After evaluating the sourcePath, it returns all primary emails. Applying the elementAt function with index 0 then retrieves the first primary email from this array. |
|
encode |
|
The function encode is part of the Read transformation of some proxy systems (like AS ABAP). It encodes the value specified by the sourcePath or sourceVariable mapping attribute, by using specified encoding algorithm. The function can accept a Byte array or everything that has a string representation. The string is assumed in UTF-8 character encoding. Function result: String EXAMPLE: For example, if the input JSON code contains the following user name: {
"USERNAME": "JOHN*SMITH/Junior"
}
The base32 encoded result will be the following id: {
"id": "JJHUQTRKKNGUSVCIF5FHK3TJN5ZA===="
}
The encode function reads the USERNAME string and writes the encoded value into the id path. The base32 padding symbols (==) are skipped. |
|
getMatchedRegexGroup |
|
This function checks whether a given string matches the provided regular expression (regex), and returns the required group. For example, when the value of groupIndex is:
|
|
manipulateDate |
|
This function converts one date format into another after JSONPath transformations. Use cases:
The manipulateDate function supports the following operations:
|
|
matchRegex |
|
This function checks whether a given string matches the provided regular expression and returns a Boolean result. |
|
putIfAbsent |
|
This function works on user attributes of type array (list of elements), as each element consists of key-value pairs. If an element key misses a value, the putIfAbsent function will set a default value for this key. |
|
putIfPresent |
|
This function works on user attributes of type array (list of elements), as each element consists of key-value pairs.
|
|
randomPassword |
|
This function generates a random password. It picks characters from four character sets - digits, lowercase letters, uppercase letters, and special symbols. Bear in mind the following tips:
|
|
renameMapEntry |
|
This function reads the sourceKey String from the source JSON and renames it with the given targetKey String in the target JSON. EXAMPLE: For example, if the source entity contains the following roles: { "role": [{"roleName": "ROLE1"},{"roleName": "ROLE2"}] }
After applying the function: {
"sourcePath": "$.user.role",
"optional": true,
"targetPath": "$.groups",
"preserveArrayWithSingleElement": true,
"functions": [
{
"function": "renameMapEntry",
"sourceKey": "roleName",
"targetKey": "value"
}
]
}
The sourceKey String in the target JSON is replaced with the one given in the targetKey and the result is: { "groups":[{"value":"ROLE1"},{"value":"ROLE2"}] }
|
|
replaceString |
|
This function reads strings from the source system and then replaces each substring that matches the value of the target parameter with the replacement one. For example, let's say the source system contains a string "National College of Linguistics and History". The target substring is "National" and the replacement substring is "European". Then, in the target system the main string will be written as "European College of Linguistics and History". |
|
replaceFirstString |
|
This function replaces the first substring of a given string that matches the provided regex with the string in replacement. |
|
replaceLastString |
|
This function replaces the last substring of a given string that matches the provided regex with the string in replacement. |
|
replaceAllString |
|
This function replaces each substring of the given string that matches the provided regex with the string in replacement. |
|
resolveEntityIds |
entityType Required: No Possible values:
Default value: user
|
This function resolves the value of a source system attribute to an existing back-end key in the target system. It should be used only in the transformation mappings of the target system. For example, it can resolve the value of a source system member attribute to the ID of an existing SCIM resource that represents this member in a SCIM target system. The sourceSystemName and the targetSystemName parameters are typically used within this function to resolve group members. In the following example, we assume that you have created two source systems reading entities from one and the same user store (for example, Microsoft Entra ID). You provision users from SourceSystem1 and groups from SourceSystem2 to one and the same target system. By specifying the sourceSystemName as SourceSystem1, the user IDs of the group members in SourceSystem2 will be resolved against the user IDs in the SourceSystem1. |
|
splitStringToArray |
|
This function splits the initial String using the defined separator and produces as a result an array of Strings or objects. In the following examples, function splitStringToArray is applied to the sourcePath, read from the source system. Based on the targetPath defined, the initial String will be split into array of Strings or objects. Example 1 In the first example, the initial String we use is: "countries": "Serbia,Germany,Spain" The transformation using the function is the following: {
"sourcePath": "$.countries",
"targetPath": "$.countryList",
"functions": [
{
"function": "splitStringToArray",
"separator": ","
}
]
},
After the function execution, the output results to the following array of Strings: "countryList": [ "Serbia", "Germany", "Spain" ], Example 2 In the second example, we use the same initial String: "countries": "Serbia,Germany,Spain"
In this case, the targetPath in the transformation using the function supports multiple values:
{
"sourcePath": "$.countries",
"targetPath": "$.countryList[?(@.name)]",
"functions": [
{
"function": "splitStringToArray",
"separator": ","
}
]
},
After the function execution, the output results to the following array of objects: "countryList": [
{
"name": "Serbia"
},
{
"name": "Germany"
},
{
"name": "Spain"
}
],
|
|
substring |
|
This function returns a string if endIndex is not provided. It begins at the specified beginIndex and extends either to the character at index endIndex - 1 or to the end of this string. |
|
toString |
|
This function accepts a Byte array or a string representation. The string is assumed in UTF-8 character encoding. Function result: String. To see a relevant example, go to function encode and decode. |
|
toUpperCaseString |
|
This function converts all the characters in the given string to upper case, using the provided locale, or if nothing defined – English. |
|
toLowerCaseString |
|
This function converts all the characters in the given string to lower case, using the provided locale, or if nothing defined – English. |

