Templates
Verified against source (3)
Interfaces/ITemplate.csapplication/Enumerations.csapplication/GenericObject.cs
The ITemplate contract
Section titled “The ITemplate contract”Template classes (for example DecisionTemplate, AttachmentTemplate, MessageTemplate, ProcessTemplate) implement ITemplate:
| Member | Purpose |
|---|---|
AppliesTo |
Table name that templated records may attach to (their Object). |
Repeatable |
Repeatability enum: how many templated records a parent may have. |
CustomStatusList / CustomTypeList |
When true, status/type lists are driven by the template instead of the record type. |
ExtranetEnabled |
Extranet enum: whether and how templated records join row-level partner security. |
IdLookup(name) |
Resolves a template name to its ID (cached). |
CreateInstance(parent, parameters) |
Creates a record from the template under a parent. |
Repeatability
Section titled “Repeatability”public enum Repeatability { One = 0, OneActive = 1, Many = 2 }OneActive counts only records whose status is not a final status.
Extranet
Section titled “Extranet”public enum Extranet { None, Self, Family, Template }Template: access is controlled by users having access to the template; no direct access to the instance is required.
Repeatability on save
Section titled “Repeatability on save”When a templated record is saved without an ID and with a Template (or TemplateID, {Table}Template, {Table}TemplateID), GenericObject.SetProperties runs SelectByTemplate before inserting:
- Existing parent (
Object+ObjectID):SelectByTemplatelooks for a record that the template’sRepeatablerule says should be reused. If found, the existing record is selected and the new properties are merged into it — the save becomes an update. WithMany, nothing is reused and a new record is inserted. - New parent created in the same call (
Objectset, noObjectID, parent properties supplied): the parent is being inserted, so repeatability can’t conflict;SelectByTemplatestill applies the template’s defaults (such as the record’s name). SelectByTemplate=0skips the lookup entirely — including template defaults — so it isn’t a way to force a new record. UseRepeatable = Manyon the template instead.
Creating the parent in the same call
Section titled “Creating the parent in the same call”Parent properties are read from parameters prefixed with the parent’s object name, {Object}_. Nested collections use {Object}_{Collection}_{index}_{Field}. For example, a web form that creates an organization, a contact on it, and a workflow under it in one request:
POST /api/decision/save ?Template=QMS Demo Request &Object=Organization &Organization_Organization=Acme Lending &Organization_Email=info@acme.example &Organization_Contacts_0_FirstName=Ada &Organization_Contacts_0_LastName=Lovelace &Organization_Contacts_0_Email=ada@acme.example &Output=XmlThe XML response contains the new DecisionID and the parent’s ObjectID. (JSON output omits the record’s data fields; use Output=Xml when you need IDs back.)