A versioned template in DocuMotor is essentially a collection of templates that allows the user to keep a version (template) in production while updating e.g., next years template in another version.
The content of versioned templates is restricted to the supported templates.
Create versioned templates
A versioned template is created by accessing the Templates tab for a unit, clicking the button Create new…, and selecting Versioned template, as shown below.
A dialog box pops up after clicking on Versioned template, where the name of the new versioned template is supplied in the Enter new name textbox. Press Ok to create the versioned template.
Create versions
Once a versioned template is created, versions can be created within the collection by accessing the versioned template, e.g., CV Collection above, and clicking the button Create new version, as shown below.
Stages
Stages are unit-wide. The administration of stages is elaborated upon in the Unit Management guide.
Existing stages are shown for each version within the collection, as shown below marked with red.
Stages are sorted alphabetically, and new stages will be appended when accessing the versioned template.
Versioned templates require that stages are created and assigned to versions within the collection.
An assigned stage is indicated with bold text, which is also shown above, where stage prod is assigned to the version CV 2021.
Furthermore, a stage can only be assigned to one version at a time. Using the above example, assigning stage prod to CV 2022 will automatically un-assign stage prod from CV 2021 – as shown below.
N.B. newly created stages must be manually assigned to a version. Once a stage has been assigned to a version, it cannot be deleted from the management dashboard.
Assign a stage to a version
To assign stage a stage to a version, hover over the version to which the stage must be assigned, and click the stage to assign, shown below.
Clicking a stage shows a dialog box. To finalize assigning the selected stage to the selected version, in this example prod to CV 2021, click Confirm.
Once confirmed, the stage prod will be assigned to version CV 2021 and removed from version CV 2022, as shown below.
Generating documents
DocuMotor supports document generation of versions within a versioned template. Postman and Curl code snippets can be accessed by clicking the code snippet shown below, marked with red.
Generating versioned documents uses the same endpoint as regular documents with two differences:
- ID provided is that of the versioned template (parent of the version)
- stageId must be added in the header of the call
- stageId is the ID of the particular stage, see Unit Management for more
If both stageId and stageName are provided in the header, only stageId is considered.
With versioned templates, there is no need for the ID of the version when calling DocuMotors generate API, as the version ID is located using the ID of the versioned template and the ID or Tag of the stage.
Accessing the code snippet will, as mentioned, provide the user with Curl or Postman code snippets, as shown below.
Existing stages related to the current unit are shown and can be toggled between, to update the calls with new data.
N.B. If a stage that is not assigned to any version is selected, the constructed code snippet will not work if used. Make sure to only use code snippets from stages that are assigned to versions.