WriteTemplateExtension
Adds, replaces and removes extension Properties for the children of one parent Item, then persists them.
Remarks
Section titled “Remarks”Changes accumulate on this instance and are stored only when update resolves. Property values that
children store under an extension key are readable and writable once the extension is persisted.
Example
Section titled “Example”Add a Property and persist it
const extension = await directory.extensions(ctx.apps.employeeProfile.templates.employee);extension.add('isRemote', 'boolean', { label: 'Remote' });await extension.update();Extends
Section titled “Extends”Properties
Section titled “Properties”definition
Section titled “definition”
readonlydefinition:TemplateDefinition
The Template definition with properties replaced by the extended Property set.
Inherited from
Section titled “Inherited from”ReadTemplateExtension.definition
readonlyprn:string
The PRN of the extended Template.
Inherited from
Section titled “Inherited from”properties
Section titled “properties”
readonlyproperties:Record<string,PropertyDefinition>
Template Properties and extension Properties together, keyed by Property key; extensions carry isExtension: true.
Inherited from
Section titled “Inherited from”ReadTemplateExtension.properties
Methods
Section titled “Methods”Call Signature
Section titled “Call Signature”add(
key,type,options?):PropertyBuilder
Starts a new extension Property and returns its builder for further configuration.
Parameters
Section titled “Parameters”string
The Property key; it must be a valid key.
PrimitiveDataType | TemporalDataType
The data type of the new Property. boolean, date and single-select are accepted.
options?
Section titled “options?”PropertyDefinitionOptions<PropertyDefinitionType>
Label and format for the Property.
Returns
Section titled “Returns”A PropertyBuilder, or a SelectPropertyBuilder for single-select so that options can be added.
Throws
Section titled “Throws”when type is not one of the accepted types.
Call Signature
Section titled “Call Signature”add(
key,type,options?):SelectPropertyBuilder
Starts a new select extension Property and returns a builder that accepts its options.
Parameters
Section titled “Parameters”string
The Property key; it must be a valid key.
The select data type; single-select is accepted.
options?
Section titled “options?”PropertyDefinitionOptions<PropertyDefinitionType>
Label and format for the Property.
Returns
Section titled “Returns”Throws
Section titled “Throws”when type is not an accepted type.
Call Signature
Section titled “Call Signature”add(
key,type,options?):unknown
Starts a new extension Property of any data type, returning the builder matching the type.
Parameters
Section titled “Parameters”string
The Property key; it must be a valid key.
The data type; boolean, date and single-select are accepted.
options?
Section titled “options?”PropertyDefinitionOptions<PropertyDefinitionType>
Label and format for the Property.
Returns
Section titled “Returns”unknown
Throws
Section titled “Throws”when type is not an accepted type.
remove()
Section titled “remove()”remove(
key):this
Removes a previously persisted extension Property.
Parameters
Section titled “Parameters”string
The key of the extension Property to remove.
Returns
Section titled “Returns”this
set(
definition):this
Adds or replaces an extension Property from a complete definition, superseding any builder started with add
for the same key.
Parameters
Section titled “Parameters”definition
Section titled “definition”The Property definition to store; it must be valid and carry a valid key.
Returns
Section titled “Returns”this
Throws
Section titled “Throws”when the definition is not a valid Property definition.
update()
Section titled “update()”update():
Promise<WriteTemplateExtension>
Persists the accumulated changes on the parent Item.
Returns
Section titled “Returns”Promise<WriteTemplateExtension>
A fresh extension reflecting the stored state.

