Identity Cloud

Script triggers defined in mappings

For information about how managed objects in mappings are handled, and the script triggers available, refer to Object-mapping objects.

Object-mapping object

The following list describes the variables for each trigger:

correlationQuery, correlationScript

Return a JSON object. Variables:

  • source: Represents the source object.

  • linkQualifier: The link qualifier associated with the current sync.

  • context: Information related to the current request, such as source and target.

linkQualifiers

Returns a JSON object. Variables:

  • mapping: The name of the current mapping.

  • object: The value of the source object. During a DELETE event, that source object may not exist, and may be null.

  • oldValue: The former value of the deleted source object, if any. If the source object is new, oldValue will be null. When there are deleted objects, oldValue is populated only if the source is a managed object.

  • returnAll (boolean): Link qualifier scripts must return every valid link qualifier when returnAll is true, independent of the source object. If returnAll is true, the script must not attempt to use the object variable, because it will be null. It’s best practice to configure scripts to start with a check for the value of returnAll.

  • context: Information related to the current request, such as source and target.

onCreate

Returns a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • situation: The situation associated with the current sync operation.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

  • sourceId: The object ID for the source object.

  • targetId: The object ID for the target object.

  • mappingConfig: A configuration object representing the mapping being processed.

onDelete, onUpdate

Return a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • oldTarget: Represents the target object prior to the DELETE or UPDATE action.

  • situation: The situation associated with the current sync operation.

  • linkQualifier: The link qualifier associated with the current sync.

  • context: Information related to the current sync operation.

  • sourceId: The object ID for the source object.

  • targetId: The object ID for the target object.

  • mappingConfig: A configuration object representing the mapping being processed.

onLink, onUnlink

Return a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

  • sourceId: The object ID for the source object.

  • targetId: The object ID for the target object.

  • mappingConfig: A configuration object representing the mapping being processed.

onError

Returns a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

  • situation: The situation associated with the current sync operation.

  • sourceId: The object ID for the source object.

  • targetId: The object ID for the target object.

  • oldSource: Available during UPDATE and DELETE operations performed through implicit sync. With implicit synchronization, the synchronization operation is triggered by a specific change to the source object. As such, implicit sync can populate the old value within the oldSource variable and pass it on to the sync engine.

  • error: The result of the resource exception, as a JSON object.

  • mappingConfig: A configuration object representing the mapping being processed.

result

Returns JSON object of reconciliation results. Variables:

  • source: Provides statistics about the source phase of the reconciliation.

  • target: Provides statistics about the target phase of the reconciliation.

  • context: Information related to the current operation, such as source and target.

  • global: Provides statistics about the entire reconciliation operation.

  • mappingConfig: A configuration object representing the mapping being processed.

  • reconState: Provides the state of reconciliation operation; such as, success, failure, or active.

validSource

Returns a boolean. Variables:

  • source: Represents the source object.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

validTarget

Returns a boolean. Variables:

  • target: Represents the target object.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

Property object

The following list describes the variables for each trigger:

condition

Returns a boolean. Variables:

  • object: The current object being mapped.

  • context: Information related to the current operation, such as source and target.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • target: Represents the target object.

  • oldTarget: Represents the target object prior to any changes.

  • oldSource: Available during UPDATE and DELETE operations performed through implicit sync. With implicit synchronization, the synchronization operation is triggered by a specific change to the source object. As such, implicit sync can populate the old value within the oldSource variable and pass it on to the sync engine.

    During reconciliation operations oldSource will be undefined. A reconciliation operation cannot populate the value of the oldSource variable as it has no awareness of the specific change to the source object. Reconciliation simply synchronizes the static source object to the target.

transform

Returns a JSON object. Variables:

  • source: Represents the source object.

  • linkQualifier: The link qualifier associated with the current sync operation.

  • context: Information related to the current sync operation.

Policy object

The following list describes the variables for each trigger:

action

Returns a string or a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • sourceAction (boolean): Indicates whether the action is being processed during the source or target synchronization phase (true if performed during a source synchronization, false if performed during a target synchronization).

  • linkQualifier: The link qualifier used for this operation (default if no other link qualifier is specified).

  • context: Information related to the current sync operation.

  • recon: Represents the reconciliation operation.

  • The recon.actionParam object contains information about the current reconciliation operation and includes the following variables:

    • reconId: The ID of the reconciliation operation.

    • mapping: The mapping for which the reconciliation was performed, for example, systemLdapAccounts_managedUser.

    • situation: The situation encountered, for example, AMBIGUOUS.

    • action: The default action that would be used for this situation, if not for this script. The script being executed replaces the default action (and is used instead of any other named action).

    • sourceId: The _id value of the source record.

    • linkQualifier: The link qualifier used for that mapping, (default if no other link qualifier is specified).

    • ambiguousTargetIds: An array of the target object IDs that were found in an AMBIGUOUS situation during correlation.

    • _action: The synchronization action (only performAction is supported).

postAction

Returns a JSON object. Variables:

  • source: Represents the source object.

  • target: Represents the target object.

  • action: The sync action that was performed.

  • sourceAction (boolean): Indicates whether the action is being processed during the source or target synchronization phase (true if performed during a source synchronization, false if performed during a target synchronization).

  • linkQualifier: The link qualifier used for this operation (default if no other link qualifier is specified).

  • reconId: Represents the ID of the reconciliation.

  • situation: Represents the situation for this policy.

  • context: Information related to the current operation, such as source and target.

Copyright © 2010-2024 ForgeRock, all rights reserved.