Adds the key-value pair to the AltIds of this object. This will overwrite any existing value for the key on any object that has the same classId without warning you, so use this with caution.
An object of alternate ids for this object, with values as [[AltId]]
An array of alternate ids for this object.
Same as calling optAncestor(var).orElse(null)
If this object is a Collection it returns it as an array. The majority of objects in the system are Collections. For most objects, this is the same as calling [[children]].
Get the children of the object. This retrieval goes one level deep.
OptionalclassType: string | numberClears a document field to no longer reference a document.
If shouldDelete is true, it will also delete the document it's referencing.
If shouldDelete is false, it will leave the document untouched.
If shouldDelete is absent, it will follow the document's cleanup policy (defined in field edit).
OptionalshouldDelete: booleanSame as calling documentVersions().content(settings). See [[DocumentVersions.content]]
Sets the content to the provided bytes after applying [[NewContentSettings]]. Same as newContent().apply(settings).content(bytes)
Sets the content to the string after applying [[NewContentSettings]]. Same as newContent().apply(settings).content(content)
See [[DocumentVersions.contentFromUrl]]
Same as calling documentVersions().contentSize(). See [[DocumentVersions.contentSize]]
Same as calling documentVersions().contentTimestamp(). See [[DocumentVersions.contentTimestamp]]
Same as calling documentVersions().contentType(). See [[DocumentVersions.contentType]]
Same as calling documentVersions().contentType(
The modification context of this object. Contains metadata about the last modification, such as which formula(s) triggered the change. Returns null if no context is available.
The "created at" timestamp of this object.
Same as calling documentVersions().createdCredential(). See [[DocumentVersions.createdCredential]]
Same as calling documentVersions().createdTimestamp(). See [[DocumentVersions.createdTimestamp]]
The creator of this object.
Same as calling documentVersions().davUrl(). See [[DocumentVersions.davUrl]]
The deleted children of this object. Only looks one level deep. E.g. a form's deleted children could include fields and form entries. A folder's deleted children could include folders, forms, and formulas, but not any of those forms' entries.
TODO
The default display name of this object. For the most part, this is the same as calling toString(), which is the same as inserting the object into a string.
Sets the Display Name.
TODO
Same as calling documentVersions().existingContent(). See [[DocumentVersions.existingContent]]
Same as calling documentVersions().filename(). See [[DocumentVersions.filename]]
Same as calling documentVersions().folder(). See [[DocumentVersions.folder]]
Same as calling documentVersions().forInputStream(settings, input => {}). See [[DocumentVersions.forInputStream]]
Returns this field's [[FormMetaData]] object.
Sets the content to the provided OutputStream after applying [[NewContentSettings]]. Same as newContent().apply(settings).forOutputStream(out => {})
When the field links nothing yet this creates a document and links it, filed in the settings' folder — or, without one, in this field's own default folder, which is the library root only while the field is left unconfigured (see [[NewContent.folder]]).
When the field already links a document, that document is rewritten in place instead: it keeps its identity and its folder, takes the new content and filename, and folder is ignored. [[val]] (null) or [[clear]] first if you want a second document rather than a new version of the one already linked.
Same as calling documentVersions().forReader(settings,reader => {}). See [[DocumentVersions.forReader]]
Sets the content to the provided Writer after applying [[NewContentSettings]]. Same as newContent().apply(settings).forWriter(writer => {})
Same as calling documentVersions().fullPath(). See [[DocumentVersions.fullPath]]
Gets an array of all the object's ancestors.
The [[Id]] of this object bounded to T.
Same as calling documentVersions().imageHeight(). See [[DocumentVersions.imageHeight]]
Same as calling documentVersions().imageWidth(). See [[DocumentVersions.imageWidth]]
Same as calling documentVersions().notes(). See [[DocumentVersions.isVersioned]]
TODO
Returns the Local Cache object for this Thread/Base Object.
Same as calling optLock().orElse(null)
Optionaloptions: stringReturns the [[FieldMetaData]] object that this describes this field.
Same as calling documentVersions().modifiedTimestamp(). See [[DocumentVersions.modifiedTimestamp]]
The [[User]] that last modified this object.
TODO
Optionalcreate: booleanReturn a [[NewContent]]
Same as calling documentVersions().notes(). See [[DocumentVersions.notes]]
Same as calling documentVersions().notes(
The linked document, or empty when this field links nothing.
Distinct from [[documentVersions]], which always returns a document — an unsaved, empty one when the field is unset, so that content can be written to it. Use this (or val()) to ask whether a document is actually linked; use [[documentVersions]] to write.
A [[Java.Optional]] of the ancestor with the specific class.
A [[Java.Optional]] of the current object's parent object.
OptionalclassType: string | numberSame as calling optParent(var).orElse(null)
OptionalclassType: string | numberSame as calling documentVersions().path(). See [[DocumentVersions.path]]
Same as calling documentVersions().permUrl(). See [[DocumentVersions.permUrl]]
Same as calling documentVersions().referenceCount(). See [[DocumentVersions.referenceCount]]
Removes the AltId with the specified key from this object, if it has one. There is no error if the key does not exist.
Same as calling documentVersions().rename(filename). See [[DocumentVersions.rename]]
Reset the current object so that it is cleared from the cache and looked up from the database.
Same as calling documentVersions().thumbnail(). See [[DocumentVersions.thumbnail]]
Same as calling documentVersions().thumbnail(thumbnailSettings). See [[DocumentVersions.thumbnail]]
Same as calling documentVersions().toBytes(settings). See [[DocumentVersions.toBytes]]
The [[Id]] or [[AltId]] that the system deems most relevant.
Makes changes to the database for this object
Points this field at an existing document instead of uploading new content.
When the document already lives anywhere in this record's document library — see [[BaseRecord.documentLibrary]]; any folder of it counts, not just the root — nothing is moved or copied, only the link changes. A document from a different library is relocated into this one first: moved when no other field links it, copied otherwise.
The document previously linked here is released according to the field's cleanup policy, exactly as [[clear]] does. Passing null clears the field.
The document must already exist; passing an unsaved one is an error.
The document to link, or null to clear the field.
// attach the library's copy if we already have one, rather than re-uploading
const docLib = entry.formRecord().record().documentLibrary();
const existing = docLib.documentsAsMap().get(filename);
if (existing) {
document.val(existing);
}
Set the field's value.
Optional value for this field. Alias for [[opt]].
Same as calling documentVersions().versioned(
The versions of this object.
The versions of this object.
Returns a view URL for this object, if it has one. This value is always a relative URL, meaning it does not contain the protocol prefix or domain name such as http://xyz.bluestep.net.
A [[Field]] type holding a link to a single document.
The field owns a link, not the bytes: the document itself lives in the record's document library (see [[BaseRecord.documentLibrary]]), and several fields may link the same document.
Writing content — [[content]], [[forOutputStream]], [[forWriter]], [[contentFromUrl]] — creates a document and links it only while the field links nothing. Once a document is linked, those same calls rewrite that document in place instead: same identity, same folder, new content and name. [[val]] links a document that already exists; [[clear]] unlinks, deleting the document or not according to the field's cleanup policy.
val()and [[opt]] read back the linked document, and are empty when nothing is linked — including when the link dangles because its document was deleted from the library.Example: ```javascript // upload once, then link on every later run instead of duplicating const docLib = entry.formRecord().record().documentLibrary(); const existing = docLib.documentsAsMap().get(filename); if (existing) { document.val(existing); } else { document.forOutputStream({ contentType: 'application/pdf', filename, folder: docLib }, out => source.transferTo(out)); } ```