Run Scripts on Managed Objects
Before implementing a script, it’s highly recommended that you validate the script over REST. Use scripts in a test environment before deploying them to a production environment.
A number of script hooks let you manipulate managed objects using scripts. Scripts can be triggered during various stages of the lifecycle of the managed object, and are defined in the managed object schema.
You can trigger scripts when a managed object is created (onCreate), updated (onUpdate), retrieved (onRetrieve), deleted (onDelete), validated (onValidate), or stored in the repository (onStore). You can also trigger a script when a change to a managed object triggers an implicit synchronization operation (onSync).
Post-action scripts let you manipulate objects after they are created (postCreate), updated (postUpdate), and deleted (postDelete).
The following sample schema runs a script to check that a role has no members before attempting to delete the role: