Customizing the Check Report via Extensions in Dynamics 365 for Operations

by | Updated December 18, 2017 | Development, Dynamics 365 for Finance and Operations

Recently I was asked to customize the Cheque_US report in Dynamics 365 for Operations. Based on this guidance from Microsoft I expected it to be a relatively easy and straightforward process. Here’s what I did to customize the check report via extensions:

  1. Duplicate the Cheque_US SSRS report to a model that extends the Application Suite model.

I called my new report MyCheque_US and added some text to indicate that it was the custom report—that way I could tell at a glance if I was looking at the stock report or my custom report.

  1. Create a new class MyChequeController that extends the ChequeController class in the same custom model.

Copy the main() method from ChequeController, and update it to use the report name for MyCheque_US:

 

  1. Extend the Cheque_US output menu item in the same custom model.

Set the Object property to refer to MyChequeController rather than ChequeController

The Object property is changed to MyChequeController rather than ChequeController.

I then compiled my solution and deployed the MyCheque_US report, and when I generated a payment everything worked! Well, almost everything: the custom report displayed as a blank page. I verified that if I switched back to the stock controller code controller.parmReportName(controller.getChequeReport()) then everything printed fine, but if I ran the same data through the MyCheque_US report it would fail every time.

After some digging I came to a startling conclusion. Based on its name and signature, I was trusting getChequeReport() to be a true accessor method:

getChequeReport() was trusted to be a true accessor method.

When I inspected the method itself, though, it quickly became apparent that it was something very different:

 

 

ChequeController.getChequeReport() violates two method writing best practices: a method should do only one thing, and method names should reveal intention.

The giveaway that getChequeReport() does more than one thing is the “and” in the documentation summary. If you need to use the word “and” when describing what a method does, the method does too many things!

Admittedly, the method name getChequeReport does communicate what the method returns. The problem is that it doesn’t communicate everything that the method does. Had it instead been named initAndGetChequeReport then the intent of the method would be clear (and would clearly indicate that the method does too many things.)

In hindsight it would have been better to split getChequeReport() up into two methods, one to initialize the report and the other to retrieve the report name. In the end I decided that the least risky way to solve my problem was to keep the stock call to parmReportName() in place, and follow it up with another call to parmReportName() to direct execution to my custom report:

 

 

Now the report gets properly initialized, and my custom report design is used to generate the check.

Related Posts

1 Comment

  1. Eugene Shamshurin

    Thank you for the walk-through, Tim! Great help to those who do check customization during implementation!

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

november

05nov11:00 am12:00 pmConfab with Stoneridge - Livestream - Project Oakdale: The NEW Integration of Power Platform into Teams

18nov10:00 am10:30 amThe Modern Manufacturer - Tears and Trauma of MRP

19nov11:00 am12:00 pmConfab with Stoneridge - Livestream - Project Oaktree: NEW Functionality for Dynamics 365 Manufacturing

december

02dec9:00 am12:00 pmOnline Workshop - Dynamics GP Year End Close (Morning Session)

03dec11:00 am12:00 pmConfab with Stoneridge - Livestream: Live Agents, Power Virtual Agents, Omnichannel – Oh My!

03dec1:00 pm4:00 pmOnline Workshop - Dynamics GP Year End Close (Afternoon Session)

09dec10:00 am10:30 amThe Modern Manufacturer - Manufacturing Policy Management

17dec11:00 am12:00 pmConfab with Stoneridge - Livestream - Technology in 2020: A Year in Review

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X