Skip to content

Document

Represents a version of a document in a document archive.

Remarks

Get a document with $Documents.Get, or create one with $Documents.New. A document version has a title, files, profile data defined by its content type, and an access control list.

Changes are kept in memory until Document.Save or Document.Publish is called. Save keeps a new document as a draft; Publish with a folder path makes it visible in that folder. The Document.State decides what can be changed: a published, deleted or archived version keeps its files and version number, while its title, description, profile data and access control list remain editable.

$Documents does not check the access rights of the current user. Check them in the script when it acts on behalf of a user.

Examples

Create and publish a document

1
2
3
4
5
6
var doc = $Documents.New('Contract ' + $Xml.Evaluate('ContractNumber'));

doc.Files.AddFile($Xml.Evaluate('ContractFile'));
doc.Publish('Legal\\Contracts');

$Xml.SetValue('DocumentId', doc.Id);

Capabilities

Security and Profile

Metadata

Properties

File Content

  • Document.Files: Gets the collection of attached files for the document.

Lifecycle

  • Document.Archive: Archives the document and returns the current document instance.
  • Document.Delete: Marks this document version as deleted without removing its profile or attached files.
  • Document.Publish: Publishes the document to the specified folders and returns the current document instance.
  • Document.Purge: Permanently removes this document version and its attached file records from the repository.
  • Document.Save: Saves the changes to the document and returns the current document instance.
  • Document.Unpublish: Changes this version to Draft, saves it, and removes all folder associations from the document family.