This article describes how to define dynamic document names in DocumentsCorePack (DCP) templates. The “Document Name” property allows you to define a name or a name pattern within DCP templates. Once defined, documents generated automatically will have an automatically generated specific name.
Example: You have a document for a Quote ID: QUO-01007-B9F71. If the document name property is defined as “Quote_<<quotenumber>>” the generated document will be named “Quote_QUO-01007-B9F71.pdf“. Thus, all fields from the Dynamics 365 record itself can be used within the document name.
If you are unsure how to gain access to the template settings to set the document subject, have a look at this article before continuing.
Step 1: Access the “Document Name and Subject” section
❶ Navigate to “Document Name and Subject”.
Step 2: Set your ❷ “Document Name Pattern”
Insert a field by double-clicking it in the tree or by typing in a fixed text enclosed by single quotes.
The basic rules for the syntax of this property are:
- Dynamics 365 fields have to be enclosed by <<and>>
- Fixed text has to be enclosed by single quotes (‘).
- Fields and fixed text have to be combined with a plus (+).
- You can display the name in upper case when using the upper function. Example: Documentname: ‘Inv-‘+<<name>>.upper().
Details about the syntax for this property can be found here: DocumentsCorePack Property Syntax.
Step 3: Save your template
Before you can use or test your template, you must save it. You can save your template locally with the standard ❶ “Save”, “Save as“ funcionality of MS Word, or you can use the ❷ “Save template“ option of the DCP TemplateDesigner in order to publish the template to Dynamics 365.
Step 4: Test your template
A step-by-step description of how to quickly test your template can be found here.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to email@example.com