You are here

ScriptNode Object API

In JavaScript code various parts of the underlying system can be conveniently exposed as objects of type ScriptNode. For example, the companyhome, userhome, document, space, and person objects are best represented as objects of type ScriptNode. The ScriptNode API provides access to properties and methods for manipulating this type of object.

Properties

The following properties are available to use within scripts:

id
The GUID for the node
storeType
The store type for the node
storeId
The store id for the node
nodeRef
The NodeRef corresponding to this node
qNameType
The QName type
type
Fully qualified QName type of the node
typeShort
Prefix string, or "short" QName type of the node
name
Shortcut access to the cm:name property. Can be read and written to.
children
A read-only JavaScript array of the child node objects

Example: mynode.children[0]

hasChildren
True if the node has children
assocs
A read-only associative array of the target associations of the node. Each named entry in the array contains an array of the script node objects on the end of the association.

Example: mynode.assocs["cm:translations"][0]

associations
The same as assocs
sourceAssocs
A read-only associative array of the source associations of the node. Each named entry in the array contains an array of the script node objects on the end of the association.

Example: mynode.assocs["cm:translations"][0]

sourceAssociations
The same as sourceAssocs
childAssocs
A read-only associative array of the child associations of the node. Each named entry in the array contains an array of the script node objects on the end of the association.

Example: myforumnode.childAssocs["fm:discussion"][0]

childAssociations
Same as childAssocs
parentAssocs
A read-only associative array of the parent associations of the node. Each named entry in the array contains an array of the script node objects on the end of the association.

Example: mynode.parentAssocs["cm:contains"][0]

parentAssociations
Same as parentAssocs
properties
Provides access to all the properties of this node. The properties returned are accessed via an associative array. Properties of a node can be accessed in the following ways:

Example: node.properties["name"]

Example: node.properties.name

isContainer
Returns true if the node is a folder node, or false otherwise
isDocument
Returns true if this node is a link to a container, or false otherwise
isLinkToContainer
Returns true if this node is a link to a container, or false otherwise
isLinkToDocument
Returns true if this node is a link to a document, or false otherwise
isCategory
Returns true if this node is a category, or false otherwise
aspectsSet
A list of aspects applied to this node
aspects
A read-only array of the fully qualified QName strings applied to the node
qnamePath
A read-only QName type path to this node
displayPath
A read-only display path to this node
icon16
A read-only small icon image for this node
icon32
A read-only large icon image for this node
isLocked
Returns true if the node is locked, or false otherwise
parent
Primary parent node. This will be null if this is the root node.
parents
Array of the parent nodes
getPrimaryParentAssoc
The primary prarent association so it is possible to obtain the association QName and the association type QName
siteShortName
Returns the name of the site this node is contained within. If the node is not contained within a site, the value is null

Additional APIs and properties

The ScriptNode object API also exposes a number of additional APIs which have been grouped by functional purpose in this documentation. These additional APIs include:

  • Security API
  • Ownership API
  • Modifying and creating API
  • Checkin/Checkout API
  • Versions API
  • Content API
  • ScriptContentData API
  • Transformation API
  • Thumbnail API
  • Tagging API

These APIs are documented in sub-sections of this topic.