You are here

Modifying and creating API

Most of the available ScriptNode API return read-only values, however the Scripting API also supports writable objects and access to repository services.

The ScriptNode object lets you modify and add properties, add aspects, create new files, folder, and custom type nodes, and update and set the text content stream for a node. You can also delete nodes, transform content, execute templates, and modify the associations for a node.

Remember: JavaScript objects are different to native repository Java objects. Property values in the repository must be the correct object type as defined in the Data Dictionary and exposed by the content model. This means that a string property value expects a Java string, and a multi-valued property expects a list. The Alfresco JavaScript API converts most object types between JavaScript and Java for you such as Array (for a multi-value property), numbers, dates, Boolean, and strings. The conversion code handles all common type conversions and recursive lists of those types.
Type Description
properties Property array (can be modified for updating or adding new properties)


// change the name of this document = "Backup of " +; // add a new property string["cm:locale"] = mylocalenode; // save the property modifications;

The API call is required to persist the property modifications. All other modifications made using the API, such as content or adding aspects, take immediate effect.

content A property to modify the text content of a node

Example: mynode.content = mynode.content + "append some text";

name A helper property (a shortcut for to get/set the name

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.