You can create templates that are marked as "sub-templates" in order to use their content in other templates. This feature is especially useful when a common markup is needed on multiple templates (such as signature, header).
Creating Sub-templates
A template must be marked as "sub-template" in order to be available for insertion in other templates. This can be done either at the time of creating a new template, or after - just look for a toggle or checkbox that marks the template as a sub-template.
Using Sub-templates
To add a sub-template to an existing/new template, locate the "Insert sub-templates" option within the template editor. Depending on the version you have installed in your org, this option may be located in the WYSIWYG editor or somewhere else. When you select to insert a template, you will only see templates that are marked available to be used as sub-templates. In addition, you will see the date & time of the last edit & the core object the template is based on.
Once you select a sub-template that you want to insert, the template will be added at the location of your cursor or at the beginning of the body of the template that you are editing.
Static Sub-Templates
By default, when a sub-template is added, it will be added in a "static" mode. This means that we will add the content of the selected sub-template directly to the body of the template. This allows you to make changes to the content added from the sub-template without affecting the selected sub-template.
Dynamic Sub-Templates
You can change a template from a "static" to a "dynamic" by first clicking on the square icon at the top left corner and then selecting the toggle. In doing so, you will no longer be able to edit the contents of the sub-template, nor are you going to be able to view the full content of the underlying sub-template. However, if the embedded sub-template is updated/changed, the updates will reflect immediately to all the other templates that embed that sub-template.
Considerations
- We cannot version control dynamic templates currently, meaning that every time a document is loaded with an embedded dynamic sub-template, the sub-template will be rendered with the latest version's contents. This is intentional behaviour.