Document classes can be associated with custom scripts to extend the features of AODocs.
Learn more: Create custom actions
You can attach two different types of custom scripts to your classes:
- “Viewer Actions”: when Viewer Actions scripts are configured, a custom menu appears in the document viewer interface (1) allowing end-users to run the scripts. These custom scripts can be used to add new options to the AODocs toolbar to perform business-specific actions.
Using the Custom actions menu in the AODocs toolbar
- “Update Action”: these custom scripts are executed every time the document is updated. These scripts can be used to automatically update the document (for example if you want to set a naming convention on your documents, where the document title is computed from the value of the document’s properties), or to send notifications to external applications (for example if you have a business application that needs to update its status when the properties of your AODocs documents are changed)
To configure a Viewer Action or Update Action, open the library administration interface, select “Document Classes” (2) and open the “Customization” tab (3) of the document class.
Then click on “Add new action” (4) and (5):
- Enter an “Action name”: this name will be used in the custom action menu displayed to the users (if the action is a “Viewer Action”), and it can also be retrieved in the custom script code by using the method: _getDisplayName
- Select the type of custom script you want to add:
- “action called by a user from the Document Viewer page” to add a Viewer Action custom script
- “action run when the document is opened” to add an Update Action custom script
- Select your script in the list (note that the list will only display the custom scripts of the selected type i.e. “Viewer Action” or “Update Action”).
Adding a custom action to a document class