When a document transitions into a new workflow state, AODocs can execute custom scripts to perform specific actions on the document, such as change properties values, manipulate related documents, or notify an external application.
To add custom actions to a workflow state, select your workflow in the workflow list and click on the “Customize…” button (1) of the state where you want to add the custom action.
Configuring custom actions for a workflow state
Then, click on “Add new action” (2). Note that you can add multiple custom actions in one workflow state.
You must then (3):
- enter an “Action name”: this value can be retrieved in your custom script by calling the method _getDisplayName
- select the event that will trigger the custom action:
- “action runs when the document enters this state”: in this case the custom script will be executed when a document enters this workflow state
- “action runs when the document leaves this state”: in this case the custom script will be executed when the document exits this workflow state
- select your script in the list: the list displays all the custom scripts that have been created with the type “Backend action” in your library.
Learn more here: Create custom scripts
Then, click on “Save” (4) to save. Do not forget to also save from the workflow configuration page.
Adding a custom action to a state of workflow