Tuesday, June 11, 2013

Word Templates and Report Sections

Just when you think you have something figured out, the Microsoft Word templates (with Microsoft Dynamics GP) will throw you a curve ball.  Last week, a client was having issues with the Purchase Order Blank template.  It had previously been working fine, but they wanted to print both the vendor item number and the company's item number on the form.  They added the appropriate field without issue, but when they printed the form-- it didn't show up.

So, we did the normal things...
  1. Made sure the field printed fine on the report writer report (it did)
  2. Removed and re-added the XML source to the Word template
  3. Removed and re-added the field to template
  4. Added static text to the template to make sure we were printing the right template (we were)
Urgh.  And then I noticed something odd about how the report was printing.  It seemed like none of the other sections of the report (that normally print below the item number) were actually printing.  Instead, it was printing a header line a second time.  I noticed this because the payment terms were being duplicated, printing both above and below the line items.  Odd.

But then I remembered a blog post that I had read about making sure that fields were associated with the section that are printing in.  When you are looking at the field pane, you will notice that fields are displayed based on the section (this is derived from the report writer report itself, so wherever the field is on the standard report- that is where it shows in the field pane).


So, to ensure that fields are in the correct sections on the template, you can click on Design Mode (located on the Developer pane).  It switches the view to something like this...



What I noticed when I did this is that the shipping method field in the header row was actually from the Comment 3 section.  Notice that all of the other fields in that section are from the Report  Header.  So I removed the errant field, and the PO worked great!  Then we added the field back, but this time we made sure we added the Shipping Method fields from the Report Header section.

In a standard report writer report, we can drag fields in to any section on the report.  But when working with the Word templates, it seems like you want to add fields to the section that they are defined in.  So if the field is not available within the section where you want to add it, you would want to add the field to that section on the standard report writer report and then delete/re-add the XML source to update the field list.

I just wanted to share the Design View option, as this is a quick way to check and make sure your fields align to the sections and won't cause any undesired sorting issues when you generate the template.

Christina Phillips is a Microsoft Certified Trainer and Dynamics GP Certified Professional. She is a supervising consultant with BKD Technologies, providing training, support, and project management services to new and existing Microsoft Dynamics customers. This blog represents her views only, not those of her employer.

2 comments:

Nsquare said...

Great info on the sections--I didn't realize this was the case with templates. However, I am having the same issue in getting the shipping method added to the PO Blank form. There are two captions listed under Report Header, but no fields listed for the same!
I have added the field to the PO through Report Writer, but other than generating the modified report through template generator (a process I would like to avoid) I cannot see how to access that field!
Thanks!

Christina Phillips said...

Have you gone through the process of generating the report writer report to XMl and then removing/re-adding the xml source in the word template? You would have to do that to see the new field. Check out this post, http://dynamicsgpland.blogspot.com/2011/10/adding-fields-to-word-templates.html.