Writing and executing scripts
There are a few options and implementation models by which you can write your JavaScript files and execute them in Alfresco. A couple of the most usual models are:
Writing and storing scripts in the Data Dictionary
Using Web Scripts
We will explore Web Scripts later in Chapter 10. However, in this recipe, we will see how to write and execute simple scripts from the Data Dictionary.
Getting ready
1. Open the Alfresco explorer and navigate to the Company Home | Data Dictionary | Scripts folder.
2. This is the space where all the JavaScript files should be stored. Alfresco explorer looks for JS files by default from this location. Alfresco has provided some sample scripts to make the scripting methodology more understandable.
3. We will try executing the
backup.js
script provided in this space. One way you can execute the script files is with theRun Action
method.4. Let’s assume in a particular space we have a document. We will run the
backup.js
script against this...