Add/Change contents of a document
Now as we are aware of mostly used JavaScript APIs, Alfresco objects, and syntaxes, let’s explore some example JavaScript. In the following example scripts, you will be able to witness the APIs and functionalities we discussed earlier in this chapter.
Getting ready
We will store the JavaScript files in the Company Home>Data Dictionary>Scripts>Cookbook folder (this folder does not exist in your repository and create this folder).
And will run the sample scripts against a document—Test_JS_API.txt in the folder Company Home>InfoAxon>Chapter 8. I have uploaded this text file with a simple line of text: A sample Document created to investigate in JavaScript API
. and used our custom content type iabook:Product
.
Note
We are running the sample scripts by this method, since this is one of the easiest ways to explore the scripts. However, you can also run your scripts via space rules. Later on, we will learn the most useful and prolific way of using JavaScripts...