Skip to content

NewVersion

Creates a Draft version for the specified document family; call Save or Publish to persist the record.

1
$Documents.NewVersion(branchId: string, title?: string, versionNumber?: string):Document

Parameters

string branchId
    The family BranchId, not the Id of an individual version.

string title optional
    The title of the version.

string versionNumber optional
    Optional unused Major.Minor.Revision number; otherwise the latest revision component is incremented.

Returns

The new unsaved version.

Remarks

Copies metadata, ACL, profile, and files from the highest existing version, regardless of state. Copied files have independent IDs; adding a new file does not replace those copies. An unknown branch starts a first version instead of reporting a missing document. Resolve and authorize an existing target first when revising a document. Repeated calls are not idempotent.

Examples

Create a version with a specific number

1
2
3
4
var current = $Documents.Get($Xml.Evaluate('DocumentId'));
var revision = $Documents.NewVersion(current.BranchId, current.Title, '2.0.0');

revision.Publish();

See Also