NSDocumentTemplateand NSDocumentTemplateEntity.
Why you as a developer should embrace templates
Save time
When using templates, you won’t have to add all the customer details manually to the physical documents.CreateNewPhysicalDocumentFromTemplate() is your friend!
Prevent errors
With templates, you’re less likely to get it wrong. And consequently, you have to spend less time hunting down and correcting mistakes. You’re also less likely to have to deal with wonky documents originating from the UI.Ensure consistency and sustainable CRMScripts
Brand-wise, you don’t have to concern yourself with marketing style guides, because they’re built into the templates.Find templates
List all document templates with SearchEngine
SuperOffice includes some standard templates. You can find them as well as custom templates with SearchEngine.Fetch all templates with the list agent
Fetch template info with the MDO agent
Set template for document entity
Filter documents by template
Like many MDO lists, templates can be grouped by headings, which get their labels from the Heading table. Thus the methods ending inByTemplateHeading() target a group of templates whereas methods ending in ByTemplateType() target a single template.
NSDocument[] GetDocumentsByTemplateHeading(Integer templateHeadingId)
Fetches all documents under this heading.NSDocument[] GetContactDocumentsByTemplateHeading(Integer contactId, DateTime start, DateTime end, Integer count, Integer templateHeadingId)
Fetches a limited number of documents within a time range for the given contact - filtered by template heading.NSDocument[] GetContactDocumentsByTemplateType(Integer contactId, DateTime startTime, DateTime endTime, Integer count, Integer documentTemplateId)
Fetches a limited number of documents within a time range for the given contact - filtered by template ID.Template variables
A template variable is a named placeholder that you can put in a document- or email template. When the template is applied, the variable is substituted with the actual value. For example, {name} translates to a company’s name while {atln} is the last name of an associate. This lets you automate the personalization of content. List of variablesThe date and time in template variables are controlled by the PC’s system clock.
The short and long date formats are determined by your computer’s settings.
The short and long date formats are determined by your computer’s settings.
Substitute template variables
You can still benefit from variable substitution even if you don’t use a pre-defined template.SubstituteTemplateVariables() will parse a source string and return it with templates substituted. The encoding stays the same (binary data will be returned in Base64).
The variables must have delimiters corresponding to the standard for the given generator encoding.
Non-text source data, such as the binary content of a Microsoft Word or Excel file, should be passed as Base64.
Reference
Template types
Types 1, 5, and 6 are not used for document templates.
Frequently used fields
name refers to the label displayed in the GUI and not the physical filename of the template.Common encoding
See the full list of encodings.