Synchronization actions
When an object has been assigned a situation, the synchronization process takes the configured action on that object. If no action is configured, the default action for that situation applies.
The following actions can be taken:
CREATE
-
Create and link a target object.
UPDATE
-
Link and update a target object.
DELETE
-
Delete and unlink the target object.
LINK
-
Link the correlated target object.
UNLINK
-
Unlink the linked target object.
EXCEPTION
-
Flag the link situation as an exception.
Do not use this action for liveSync mappings.
In the context of liveSync, the EXCEPTION action triggers the liveSync failure handler, and the operation is retried in accordance with the configured retry policy. This is not useful because the operation will never succeed. If the configured number of retries is high, these pointless retries can continue for a long period of time.
If the maximum number of retries is exceeded, the liveSync operation terminates and does not continue processing the entry that follows the failed (EXCEPTION) entry. LiveSync is only resumed at the next liveSync polling interval.
This behavior differs from reconciliation, where a failure to synchronize a single source-target association does not fail the entire reconciliation.
IGNORE
-
Do not change the link or target object state.
REPORT
-
Do not perform any action but report what would happen if the default action were performed.
NOREPORT
-
Do not perform any action or generate any report.
ASYNC
-
An asynchronous process has been started, so do not perform any action or generate any report.
Launch a script as an action
In addition to the static synchronization actions described previously, you can provide a script to run in specific synchronization situations. The script can be either JavaScript or Groovy. You can specify the script inline (with the "source"
property), or reference it from a file, (with the "file"
property).
The following excerpt of a sample mapping specifies that an inline script should be invoked when a synchronization operation assesses an entry as ABSENT
in the target system. The script checks whether the employeeType
property of the corresponding source entry is contractor
. If so, the source entry is ignored. Otherwise, the entry is created on the target system:
{
"situation" : "ABSENT",
"action" : {
"type" : "text/javascript",
"globals" : { },
"source" : "if (source.employeeType === 'contractor') {action='IGNORE'}
else {action='CREATE'};action;"
},
}
The following variables are available to a script that is called as an action:
-
source
-
target
-
linkQualifier
-
recon
(whererecon.actionParam
contains information about the current reconciliation operation)
For more information about the variables available to scripts, refer to Script variables.
The result obtained from evaluating this script must be a string whose value is one of the synchronization actions listed in Synchronization actions. This resulting action is shown in the reconciliation log.
To launch a script as a synchronization action using the admin UI:
-
From the navigation bar, click Configure > Mappings, and click the mapping to edit.
-
Click the Behaviors tab, and expand the Policies node.
-
Click the edit button for the situation action to edit.
-
On the Perform this Action tab, click Script, and enter the script that corresponds to the action.
-
Click Submit, and then click Save.
Launch a workflow as an action
The triggerWorkflowFromSync.js
script launches a predefined workflow when a synchronization operation assesses a particular situation. The mechanism for triggering this script is the same as for any other script. The script is provided in the openidm/bin/defaults/script/workflow
directory. If you customize the script, copy it to the script
directory of your project to ensure that your customizations are preserved during an upgrade.
The parameters for the workflow are passed as properties of the action
parameter.
The following extract of a sample mapping specifies that, when a synchronization operation assesses an entry as ABSENT
, the workflow named managedUserApproval
is invoked:
{
"situation" : "ABSENT",
"action" : {
"workflowName" : "managedUserApproval",
"type" : "text/javascript",
"file" : "workflow/triggerWorkflowFromSync.js"
}
}
To launch a workflow as a synchronization action Using the admin UI:
-
From the navigation bar, click Configure > Mappings, and click the mapping to edit.
-
Click the Behaviors tab, and expand the Policies node.
-
Click the edit button for the situation action to edit.
-
On the Perform this Action tab, click Workflow, and enter the details of the workflow to launch.
-
Click Submit, and then click Save.