Identity Cloud

Specify a source and transformation script

When adding or modifying a mapping, you can specify a source object and a transformation script to modify an object property when you run reconciliation or provisioning. For example, you may want to modify the value of a property to be the combination of values from two or more other properties.

Add or edit a mapping

  1. In the left navigation panel, click the Mapping tab.

  2. Click Outbound or Inbound.

  3. To create a property:

    1. Click + Add a property.

    2. In the drop-down list, select a property.

    3. Click Next.

    4. In the drop-down list, select a property.

    5. (Optional) To use a script to set the property, check Apply transformation script, and add or edit the script. For more information, refer to Mapping transformation script properties. To use custom global variables in the script, refer to Define custom global variables for a script.

  4. To edit a property:

    1. Double-click a mapping.

    2. In the drop-down list, edit the property.

    3. (Optional) To use a script to set the property, check Apply transformation script, and add or edit the script. For more information, refer to Mapping transformation script properties. To use custom global variables in the script, refer to Define custom global variables for a script.

  5. (Optional) To conditionally update a property mapping:

    1. Click Show advanced settings.

    2. Enable Apply conditional update.

    3. In the Conditional Update Script, add or edit the script. An update only occurs if the script evaluates to true.

    4. (Optional) To use custom global variables in the script, refer to Define custom global variables for a script.

  6. (Optional) To apply a default value if the value is null:

    1. Enable Apply a default if value is null.

    2. Enter a default value in the Default value field.

  7. Click Save.

Define custom global variables for a script

  1. In the Transformation Script field or the Conditional Update Script field, click + Add Variables.

  2. To specify the variables in a JSON format, check the JSON toggle.

  3. To give the variable a name, enter a name in the Name field.

  4. To give the variable a value, enter a value in the Value field.

  5. To add more global variables for your script, click the plus sign and repeat the previous two steps.

  6. Click Save.

Mapping transformation script properties

You can modify an object property when you run reconciliation or provisioning. For example, you may want to set the value of a property to be the combination of values from two or more other properties.

Use a mapping transformation script to define attribute transformations that occur during synchronization or provisioning.

The following table provides information about common properties you can use in a transformation script:

Property Description

source

Represents the source object or system. For example, Identity Cloud or Salesforce.
For transformations, the source property is optional. However, a source object is only available if you specify the source property.

There are two ways to define a source property in a transform script:

  • source" : "": The code declares a source property but does not set its value. The script regards the entire source property as the source.

  • source" : "<name of source property>": The code declares the source property and sets its value to the source property that is enclosed in double-quotes on the right side of the equal sign.

target

Represents the target object or system. For example, Identity Cloud or Salesforce.

default

Represents a value to assign to the attribute on the target object. This is only applicable if the value is null.

transform

A part of a mapping that defines defines transformations to apply to the property we are creating this mapping for.

condition

A declarative filter that sets the conditions under which the attribute is mapped.

The following code sample includes and uses the source, target, and transform properties to set the value of the displayName attribute on the target using a combination of the lastName and firstName attribute values from the source:

{
    "source": "",
    "target": "displayName",
    "transform": {
        "type": "text/javascript",
        "source": "source.lastName +', ' + source.firstName;"
    }
},

Allowed combinations of properties in a mapping transformation script

You can only use certain combinations of properties in a mapping transformation script. For more information about each property, refer to Mapping transformation script properties.

In a transformation script, the target property is always required, plus at least one of the following:

Property combination Description

source

Represents the source object or system. For example, Identity Cloud.

default

Represents a value to assign to the attribute on the target object if the value is null.

source + transform

The source that defines attribute transformations that occur during synchronization.

source + default

The source object or system and a value to assign to the attribute on the target object if the value is null.

source + condition

The source object and a declarative filter that sets the conditions under which the attribute is mapped.

default + condition

A value to assign to the attribute on the target object and a declarative filter that sets the conditions under which the attribute is mapped.

source + transform + default

The source object or system, a mapping that defines attribute transformations that occur during synchronization, and a value to assign to the attribute on the target object.

source + transform + condition

The source object or system, a mapping that defines attribute transformations that occur during synchronization, and a declarative filter that sets the conditions under which the attribute is mapped.

source + condition + default

The source object or system, a declarative filter that sets the conditions under which the attribute is mapped, and a value to assign to the attribute on the target object.

source + transform + default + condition

The source object or system, a mapping that defines attribute transformations that occur during synchronization, a value to assign to the attribute on the target object, and a declarative filter that sets the conditions under which the attribute is mapped.

Copyright © 2010-2023 ForgeRock, all rights reserved.