Dynamics GP - Tips and Tricks for Setting up Word Templates
The following blog post is an update to an article that originally appeared on http://dynamicsinsights.com/2013/07/26/creating-a-word-template-for-dynamics-gp
Would you like to update the look and feel of your customer facing documents? Would you also like to email those documents directly out of Dynamics GP? OR perhaps you would like to email regular reports out of GP?
The word template functionality in Microsoft Dynamics GP is pretty awesome and it will do all of this as well as allow you to have separate document types for different companies and customers.
There are a few tricks to setting up and getting things functioning and this post will walk you through the required steps. It’s important to perform these steps in order. You also will be working with the Template Configuration and Template Maintenance in Dynamics GP.
We will look at e-Mail configuration in a separate post.
Install and Configure Word Templates
You must have two applications installed before beginning this process: Microsoft Dynamics GP Add-On for Word and Open XML SDK 2.0 for Microsoft Office. Open XML will be installed when you install Dynamics GP. The Dynamics GP Add-On for Word is located on the Dynamics CD. This is something your system administrator or GP provider will need to do.
To use Microsoft Word with Dynamics GP, you must add the “Developer” tab to your ribbon bar. In Microsoft Word navigate to Options | Customize Ribbon and select “Popular Commands.” Add the Developer function to the Ribbon list and then check the box. Click “OK.”
Create and Assign Word Templates
First, you need to determine what report we’re basing our template on and whether it’s an original report or a modified report.
Word Templates are based on the standard report writer report. In order to create and assign a template the system needs to know the name of the report and also whether the report is already modified.
Tip: We recommend always basing the template on a modified version of the report for greater flexibility in the future.
Remember that the template uses Report Writer to access data. If we ever want to add a new calculated field, we need to create it first in Report Writer for it to be available in our template, thus it’s a modified report.
Reports | Template Configuration
In Dynamics GP, the configuration window allows you to enable a specific form(s) to work as a template. The following is a view of the trees which can be used to enable all documents to allow use of template or be selective by Company and Series. Mark the document(s) for which you want to create a template. At the bottom of the window, be sure to mark the ‘Enable Report Templates’ and, if desired, to ‘Allow use of the Standard form’ even though you’re using the template.
As we have mentioned, templates use the report writer backbone to gather information so you will need to create a modified GP report in Report Writer. In our example we modify the report with a definition field. You can place the definition field anywhere on the report, regardless of where you want to place it on the template, but it is a good rule of thumb to place it in the section where it is intended to print; we have added the ‘Vendor ID’ to the “Report Header” section. Save and close the report. Go back into Dynamics GP.
Dynamics | Tools | Setup | System | Alternate Modified Forms & Reports
You must give access to the modified form for the series with which you are working and you get there with the above mentioned path. Switch to the ‘modified’ version of the forms you wish to create templates for.
Creating an XML File
Now you will need to export the programing of the modified report by exporting an XML file in order to create your template. You will need to go to the entry screen of the series you are working with (Purchase Order entry in this case) and bring up a transaction to print. When you print the form, you will select the Standard form and print to a file. The file must be an XML file.
Make sure that the destination is in a shared location easily accessible.
Reports | Template Maintenance
Now you will need to create and modify your template. From the dropdown, Select the report name you will be working with; be sure that you select the modified report.
Once you have selected your modified report, you will be required to create the template you will be working with. Be sure the template line is highlited and Select “Modify” on the ribbon bar at the top.
This will launch Microsoft Word and the first thing you want to do is ensure that your modified report is being used as the source of the report. Do this follow the following steps to ensure the XML file you created is being used. First, click on the “Developer” tab on the ribbon bar to bring up that information and then click on the “Field List” tab on the ribbon bar.
Clicking “Field List” will be used in order to change the “Source File” of the report. To get to the “Source File”, look at the navigation window to the left of the document, use the drop down arrow to find and Select the XML resource. This will populate the report section list.
Once you bring up the source list, you will have to “Remove Source."
Once you click “Remove,” you will then click on “Add Source.”
When you click “Add Source,” you will select the XML file you saved. Click “Open.”
Back in Microsoft Word select the source file again using the drop down. Select the Report Section in which you placed the field definition in Report Writer, in this case it was the ‘Header-PO Header’. Scroll down to the field definitions and select the field definition that you put on the modified report in Report Writer. In this example, select “PM_Vendor_MSTR”, “Vendor ID.”
Ensure that there is a cell available where you want to position that field before you drag that field definition to the template. In this example, a cell under the vendor information was used.
Once you have made your modifications you will need to save the template as a Word document. By default the program will want to save the file to the temp directory, but it is recommended to save it to a shared location on your server, usually your GP Share folder.
TIP: Ensure that you give your file a NEW name and have the ‘maintain compatibility with previous versions of Word’ checked so that the document remains compatible as you are upgrading Word.
Click on ‘save’ and you will be returned to the Template Maintenance screen where you will now add that new template. Highlight the existing template and click the plus sign above it. This will launch Windows Explorer for you to select your saved Word template.
Select your new Word template, and then click "Open."
You may get a ‘Replace’ message if you gave the report the same name as the original. Change the name, pick a different file, or Click ‘Yes’ if you want to continue with the same name.
Next, you will assign the template to a company or companies and vendor(s). Select ‘Company’ to default this template for all Vendors in the Company or you can be selective of Vendors for this specific template if you’d like. You must have at least one ‘Default’ template per report. For our purposes we will assign the Purchase Order template to the Company.
Click ‘Company’, this will open an alternate screen. Check the box beside the Company you would like to add the document to and then select ‘set default’.
Select the correct template for this company and click on ‘Save’.
You will be taken back to the previous screen, Click ‘Save’ again; the template is now defaulted for this company.
Close the Template Maintenance screen.
When you go back to the Series Transactions screen for Purchase Orders, select your document and print the template to the screen to verify your changes. Be sure to select ‘Template’ as your report type.
You should see your template with the modifications you have made.