Using 3rd Party Series Reports in the Report Template Maintenance Lookup Window

Patrick Roth - Click for blog homepageA few weeks ago we ran into an interesting case regarding the new Word Report Templates in Dynamics GP 2010.

An ISV was working on adding templates to her Dynamics GP customization but was stymied by the "Reports" window which is the report lookup window for the Report Template Maintenance window.

In her customization, all of her reports were set to the 3rd Party series.  Unfortunately in the Reports lookup window, the 3rd Party series doesn't appear as a list of choices and so couldn't be selected.  The ISV naturally wondered if this was a bug in Dynamics GP 2010 by not having this series listed.

Checking the source code, it looks like this series was purposefully omitted for some reason.  But upon further investigation of the code, it appeared that if there were a 3rd party series listed, the rest of the window would "just work".  That was what it looked like anyway.

The ISV was given 2 options to resolve this issue and make her reports appear in the list:

  1. Just change the series of her report to one of the listed series.
  2. Try using a trigger to add "3rd Party" to the drop down list as that would appear to work.

She chose the former, just change the series of the template enabled reports.  That is likely what I would do as well - I typically never choose "3rd Party" series for anything and always choose the series my customization fits into.  Or if I'm feeling wild & crazy, I'll choose the Project series.

But to see if this would work just as easily as it appeared, I had to test it.  And as it turns out - it really was just that easy.

Startup script - Trigger Registration

 local integer l_result; 

{Need this trigger so lookup shows 3rd party series reports} 
l_result = Trigger_RegisterProcedure(script LoadSeriesDDL of form syReportLookup, 
       TRIGGER_AFTER_ORIGINAL, script syReportLookup_LoadSeriesDDL_Post);
if l_result <> SY_NOERR then 
   warning "The LoadSeriesDDL trigger is not registered."; 
end if; 

{Need this trigger so your application tells Dynamics that this is a template enabled report} 
l_result = Trigger_RegisterFunction(function IsTemplateEnabledReport of form syReportLookup, 
     TRIGGER_AFTER_ORIGINAL, function isTemplateEnabledReport_Post); 
if l_result <> SY_NOERR then 
 warning "The IsTemplateEnabledReport trigger is not registered."; 
end if;

In the Startup script above, the first trigger on LoadSeriesDDL of form syReportLookup is the trigger necessary so that 3rd Party series reports will show in the list.  The 2nd trigger is documented as required in the Microsoft Dynamics GP Integration Guide to make the specific reports show in the list.  Just like in Dynamics GP, not every report would likely be "template enabled".

Procedure syReportLookup_LoadSeriesDDL_Post

 {Check to see if this exists and if not add to DDL}
if finditem ( '(L) DDLReportSeries' of window ReportLookup of form syReportLookup, getmsg(14045)) = 0 then
    {add "3rd Party" string and item data of 10 to DDL}
 add item getmsg(14045), REPORTSERIES_3RDPARTY to '(L) DDLReportSeries' of window ReportLookup of form syReportLookup;
end if;

 Here we are using Dynamics dictionary constants & messages to add the word "3rd Party" and the series of 10 to the drop down list of the window if it isn't already there.

Function isTemplateEnabledReport_Post

 function returns boolean fResult;

in 'Product ID' nProdID;  {Product ID selected}
in Resid   nResID;   {resid of report selected}

{If product passed to function is this application, enable template processing}
if nProdID = Runtime_GetCurrentProductID() then
    {make all my reports template enabled}
  fResult = true;
end if

For simplicity, I hard coded the above procedure to make all of my reports in the customization template enabled.  In a real life application, that probably wouldn't happen and the ISV would have an "if" or "case" statement to only specify specific reports to be template enabled.

After creating my cnk and testing it in runtime (doesn't work in Dexterity test mode because it checks the dictionary and resid of the reports before adding) my customization worked correctly showing both my Sales series reports (it did that previously) and also my 3rd Party series reports (which it did not).

Best regards,
Patrick Roth
Developer Support

// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, https://opensource.org/licenses/ms-pl.html.)