Shared custom scripts are custom scripts that you create once in the AODocs tenant administration and use in every library of your domain. This article explains how they work, who can manage them, and how they differ from the custom scripts created in a library.
Note: Shared custom scripts are part of AODocs 70. If you need help designing your scripts, contact your AODocs sales representative or send an email to sales@aodocs.com.
Automatically generated table of contents
Local scripts and shared scripts
Custom scripts are code fragments that let administrators add actions to a library that aren't available out of the box in AODocs – for example, filtering which documents can be related to each other, or running logic when a document changes state.
There are two kinds of custom scripts:
- Local scripts: created and stored in a single library, by that library's administrators. To reuse the same behavior in another library, you must create and maintain another copy of the script. Local scripts keep working exactly as before.
- Shared scripts (domain-level scripts): created once and maintained centrally in the AODocs tenant administration. A shared script is available to every library on your domain as soon as it's created. When you fix or improve it, you update it in one place and then deploy the new version to the libraries that use it.
| Local script | Shared script | |
| Where it's created | In the library administration | In the AODocs tenant administration |
| Who creates and edits it | Library administrators | Super administrators and Script Administrators |
| Where it can be used | Only in its library | In every library on the domain |
| Versions | One version | Several versions: one draft and any number of promoted versions |
| How updates reach libraries | Edits apply immediately in the library | Library administrators select a version, or a Script Administrator deploys a version to several libraries at once |
Script types
Each shared script has one of six types. The type defines where the script can be configured in a library and when it runs. A script can only be used on a trigger of the same type.
| Script type | Runs when | Configured on |
| Viewer Action | A user selects a custom action in the document action bar | Document class – Trigger custom scripts in document classes |
| Workflow Transition Action | A document enters or leaves a workflow state | Workflow state – Trigger custom scripts on workflow states |
| Update Action | A document is updated (edits on attachments don't trigger it) | Document class – Trigger custom scripts in document classes |
| Relation Filter | A user adds a related document: the script filters which documents can be added | Relations – Trigger custom scripts on relations |
| Relation Render Action | The relations section of a document page loads: the script can hide or display related documents | Relations – Trigger custom scripts on relations |
| Reminder Condition | A workflow reminder is about to be sent: the script decides whether the reminder email is sent for the document | Workflow reminders – Step 5b: Configure workflow emails – Action reminders |
Note: The type is chosen when the script is created.
Draft and promoted versions
The code of a shared script – with its parameters, imports, execution settings and description – is stored in a version, not in the script itself. A script can have many versions, and each library can use a different one. A version is either:
- Draft: a work-in-progress version that you can freely edit. A script can have only one draft at a time.
- Promoted: a stable, named version. When a draft is promoted, its code and configuration are frozen; only its description can still be edited. A script can have any number of promoted versions. Older promoted versions are never removed automatically.
When a script has no open draft, you can create a new one from any promoted version. You can discard a draft you don't need, unless it's the script's only version.
Draft and promoted versions are both visible in every library and can both be selected on a trigger. This lets you test a draft in one library before you promote it. Because a draft can still change, use drafts only for testing, never in libraries that need stable behavior.
Learn more: Create and manage shared custom scripts
Who can do what
| Role | What they can do |
| Super administrator | Everything on shared scripts, by default. Assigns the Script Administrator role. Learn more: Manage AODocs super administrators |
| Script Administrator | View the repository of shared scripts; create, rename and delete shared scripts; create, edit, promote and delete versions; see which libraries use each script; deploy a version to several libraries and roll back a deployment; view the deployment history; manage library tags. Learn more: Manage Script Administrators |
| Library administrator | View shared scripts in their library (read-only) and select a version of a shared script on the triggers of their library. Library administrators can't create or edit shared scripts. Learn more: Use a shared custom script in your library |
Note: A Script Administrator can't assign the Script Administrator role to other users, and can't manage anything else in the AODocs tenant administration.
How a shared script reaches your libraries
1. A super administrator or Script Administrator creates the script. It starts with an empty draft. Learn more: Create and manage shared custom scripts
2. They write and test the draft, then promote it as a named version.
3. Library administrators select the version to use on the triggers of their library. Learn more: Use a shared custom script in your library
4. When a new version is promoted (for example, to fix a bug), a Script Administrator can deploy it to many libraries at once, and roll the deployment back if needed. Learn more: Deploy a shared custom script version to several libraries
Current limitations
- Every version of a shared script – draft or promoted – is visible and can be selected in every library. You can't limit the libraries where a draft can be tested, or restrict libraries to the latest promoted version.
- Library tags can be created, assigned and removed, but not renamed or deleted from the interface.