To configure your custom script:
1. Under Security mode, choose the permissions with which your script will run:
- Run with current user’s privileges: the script is executed with the privileges of the user who triggers the execution of the script. If the script tries to access a document on which the current user has no permission, the script fails with a permission denied error.
- Run with administrator’s privileges: the script has administrator access, so it can access all documents.
Important: Use this option with caution. These scripts can lead to a security breach. For example, an administrator script could be used by users to gain access to documents on which they have no permissions.
2. Select your execution mode
- Async execution checked: The script is executed asynchronously. It can run up to 10 minutes. This option is available only for Workflow Transition Action scripts and Update Action scripts.
Important: Asynchronous scripts can't lock a document. For instance, you can't modify the properties of documents with asynchronous script.
- Async execution unchecked: The script is executed immediately. It can run up to 1 minute.
3. In the Imports section, configure the list of classes that you want your script to import.
4. In the code editor, configure the source code of your script. Depending on the type of script, you can edit the source code of different methods. Use the Method drop-down list to select the method you want to edit:
- _execute: to execute Workflow Transition Action and Viewer Action scripts
- _isApplicable: to configure who can execute a Viewer Action script
- _getDisplayName: to return the name of a Viewer Action script defined in the document class
- _executeAsync: to execute a Viewer Action script when the execution is set as asynchronous
- _filter: to execute Relation Filter scripts
- _update: to execute Update Action scripts
- _createRelationVO: to execute Relation Render Action scripts
5. Under Parameters, you can configure parameters for your script and define the default value for each parameter.
When configuring actions using your script in workflows, document classes or relations, you can set specific values for these parameters for each action.
For example, your script could be configured in two different workflow states, and each workflow state could use different values for your script’s parameters.