When generating documents, there may be some circumstances where it would be beneficial to be able to allow users to select a header and/or footer to be used. For example, if you are sending letters that require certain headers, it would be nice if it was possible to select which header/footer to use instead of having to create multiple templates with basically the same content but only different headers.
This article will cover how to prepare your templates and enable this functionality in the DocumentsCorePack Dialog.
Prerequisites:
- DocumentsCorePack Template Designer version 10.43
Note: This article requires an understanding of our look-up prompt, filter, and Master Template features. Please refer to these features’ corresponding documentation for more information.
Step 1: Setting up the header/footer template(s)
Before beginning, you must already have a static template with a header/footer saved to your environment. A static template is a document that contains only static content. In our case, we want to use a static template that only has a header and/or footer.
For reference, this is the static template we will be using:
Step 2: Setting up the prompt in our main template
Once the static template has been created and saved, we will also need to create another template. This template will be our main template. It will be separate from the static template above, as this main template will hold the content we want to generate (e.g.: our dynamic fields and tables).
This is what our main template looks like:
To configure the dialog to display our headers/footers, we must first open our main template and establish a relationship with the MSCRM-ADDONS.com DocumentsCorePack Template entity by opening the Relationship Designer. This must be selected after selecting the Separate entities option. Then, select the Name field. This will be done in order to set up our filter later.
Then, we will create a filter. This filter should be set up so the Name attribute is selected, the Operator is set to equals, and the Value is set to the name of whichever saved template that contains the header/footer you want to use. This process should be repeated for however many headers/footers you want the user to be able to select.
If you aim to allow the selection between multiple headers/footers, it is important to set the filter type to OR and add all the different header /footer documents:
After configuring the filter, navigate to Records to show and select “Show a look-up window to select a single row.” Then, click Add/Update Labels. In the next window, select a language and add a label.
Once finished, click OK in the Relationship Designer window to save your changes.
To finish setting up your document, go to the Advanced Template Settings in the Template Designer and click on the General tab. Under Master Template, click the ellipses (…) button to select the lookup prompt you have already configured. Once selected, click OK and save your template.
Step 3: Generating the document
Return to your environment and run the dialog, selecting your configured template. If everything was set up correctly, an additional step should appear in your dialog, displaying the previously configured lookup prompt.
Select a header and proceed through to the next steps. Once the document has been generated, you should see your header at the top of the document.
That´s it! We appreciate your feedback! Please share your thoughts by sending an e-mail to support@mscrm-addons.com