JavaScript API

Repository Document

Root object: rd

Example: rd.getCreatedDate()

Add a single generic field to a document:
addSingleField(String, Object)

Add multiple values to a single field:
addArrayField(String, Object[])

Add a single Date to a field:
addSingleDateField(String, Date)

Add multiple date values to a single field:
addDateArrayField(String, Date[])

Return the created datetime of the source document as a Date:
getCreatedDate()

Return the length of the binary (first binary) as a long:
getFileLength()

Return the length of the first binary, or the originalFileLength if there are no binaries:
getDocumentLength()

The original file length is set with the first file length value applied to the document, and will not change even if the binaries change:
getOriginalFileLength()

Set the original file length field for the document:
setOriginalFileLength(long)

Return the name of the file as a String:
getFileName()

Return the last access datetime of the document as a Date:
getLastAccessedDate()

Return the hash value of the document's content as a String. In the case of multiple binaries, only the hash of the first will be returned:
getHashValue()

Return the modified date of the documents as a Date:
getModifiedDate()

Return the logical path (folder path) of the document from the source system as a String. If the document is a folder, this will be the parent folder, with the folder name's being the file name:
getPath()

Set the filename of the document on the first binary:
setFileName(String)

Set the path of the document. This can be used to modify the output location:
setPath(String)

Set the modified date of the document:
setModifiedDate(Date)

Return the mimetype as a 'String'. The int index is for files with multiple binaries, in most cases this will be 0. The returned format is type/subtype:
getMimeType(int index)

Set the mimetype of the first binary. If not binary is available, a default binary will be added with the set mimetype:
setMimeType(String)

Example: doc.setMimeType('application/octet-stream');


Binaries

Example: var binaries = rd.getBinaries()

Produces a list of 3Sixty Binary objects. The list will be empty if there is no binary


Document Fields

Obtained document fields with rd.getDocumentField(String)

Example: var field = rd.getDocumentField("title")

Produces a DocumentField object with the following methods. Returns null if the field is not present.

Get a case-insensitive version of getDocumentField():
getDocumentFieldWithLowerCase(String)

Return a FieldStringValueHolder object with some utility methods for checking field content:
getFieldAsStringHolder(String)

Check if the field is empty and return a boolean value:
isEmpty()

Check if the field has multiple values (multi-valued fields). This returns a boolean value:
isArray()

Return the values as a comma delimited list:
getSingleStringValue()

Return the value as a String array:
getArrayValue()


Versions

Example: var versionInfo = rd.getVersionInfo()

Produces a VersionInfoBean object. Null if none is present. If retrieving versions from the source repository, the task will process them in order.

Return a map of field names and document field objects. See the sample code for more information on using the map:

getFieldsMap()


Job ID

Current job ID:
Root object jobId


Job Run ID

Current job run ID:
Root object jobRunId


Printing

If you wish to print to the console (the equivalent of System.out.println), use the command print();