Frequently asked questions
Frequently asked questions
- Q. What variables can be used in scripts?
- Q. How can I use the identityServer variable in scripts?
- Q. When do onUpdate scripts run?
- Q. How can I use a postAction script?
- Q. How can I troubleshoot scripts?
- Q. How do I invoke reconciliation (or any other http operation) via REST using a script?
- Q. Can I use custom Java packages in scripts?
- Q. How do I call a Groovy script from another Groovy script?
Q. What variables can be used in scripts?
A. The variables that can be used in scripts depend on the triggers that launch the script. The available variables are detailed in the Integrator's Guide › Scripting Reference › Variables Available to Scripts.
Q. How can I use the identityServer variable in scripts?
It can also be used to return values of specific properties using getProperty, as used in the crypto.js and policyFilter.js files (located in the /path/to/idm/bin/defaults/script directory).
See Integrator's Guide › Scripting Reference › Variables Available to Scripts for further information on the identityServer variable
Q. When do onUpdate scripts run?
A. onUpdate scripts run before the LiveSync update completes and run regardless of whether the source object has changed or not. The onUpdate script must always execute because it is possible for the onUpdate action to modify the source object itself based on some business logic.
See Integrator's Guide › Data Models and Objects Reference › Managed Object Configuration for further information on when scripts run.
Q. How can I use a postAction script?
A. postAction scripts are used in the sync.json file, where you can associate them with a specific situation and action for a policy. The postAction script is invoked when the corresponding action for the specific policy situation has completed, thereby allowing you to automatically trigger an action upon completion of a related action.
The postAction script is not triggered if the action is set to either IGNORE or ASYNC.
For example, you could use a postAction script on the CREATE action to trigger an update to the LDAP object that you just created. The relevant section in the sync.json file would look similar to this:
Q. How can I troubleshoot scripts?
Q. How do I invoke reconciliation (or any other http operation) via REST using a script?
For example, an external REST call via a script would look similar to this:
openidm.action("external/rest", "call", params);
Where the call parameter specifies the action name to be used for invoking the http operation.
See How do I invoke a reconciliation using the openidm.action function in OpenIDM 3.x? and Integrator's Guide › Accessing External REST Services for further information.
A. There are known issues in IDM/OpenIDM with evaluating external transformation and conditional scripts against sample data in the Admin UI, which will be fixed in a future release of IDM/OpenIDM. One such issue is: OPENIDM-3127 (Evaluate mapping for source objects as part of reconResults).
External transformation and conditional scripts do not work when you view sample data, but do work if you process the data by performing a reconciliation. As a workaround for viewing sample data, you can include the script inline rather than as an external script.
You should also change the value of the following property in the script.json file (located in the /path/to/idm/conf directory) to a much lower value (even 0) to ensure changes are picked up quickly:
The default is 60000 (60 seconds), which means any changes made to scripts are not picked up for up to 60 seconds.
Q. Can I use custom Java packages in scripts?
- If your package name is:
Q. How do I call a Groovy script from another Groovy script?
A. This is described in How do I call one Groovy script from another in IDM/OpenIDM (All versions)?