Being a Navision/NAV person for some ages, and then Business Central person for a while also, I was so thrilled to see new – long time waited features coming up to BC with the wave 2021 w1. Microsoft Dynamics 365 Business Central Launch Event announced few really good stuffs among which, at least for me, new object type called report extension steal the show!
I am sure many NAV experienced (not old, of course) people remember the good old CSide’s Shift+F12 keystroke and two more clicks to reach the report design – both from data and UI perspective.
But then two “kinda” bad guys named RTC & AL came and took that lovely tool from us. And for several years I felt some discomfort in my stomach when client asked for just ONE additional column in their favorite reports. Yep, I “enjoyed” so much making copies of report just to add a column or two…
But it seems those days are over! What an intro for my first blog!
Now or finally, in the Business Central wave 1 2021, Microsoft responded to the cries of the community and introduced a new object type – very logical one – report extension.
The new object can extend the existing report to some extent:
So here is my try – my very own simple Hello World report extension.
The purpose of this small project was to test capabilities and not to solve some real client’s issue.
For demonstration, I took report number 3 – G/L Register in cloud BC and assume for me very common scenario – adding the Source Code column Journal Batch Name and removing some Posting Groups columns. And let’s add option to run another report after execution of the first one, just to demonstrate some capabilities.
Here is how it looks by the standard solution:
To extend the existing report G/L Register with few columns I needed to:
This worked fine in Visual Studio Code with some hassle around layout – handling layouts is just the same as it was before.
Then some more work on the request page… where I did not miss a chance for Hello World message.
Working on the request page is as before. I added my variable to be protected – accessible by other report extension, as I would preferred the same for this base report. It would boost extensibility.
My advice is do not trust IntelliSense always. It gave me modify option which is not supported in the reportextension. In request page, anchors were missing by IntelliSense, but luckily drill down to report definition worked.
Initially I tried to make some more useful scenario on a request page – like filtering the dataset beneath on the new field OnValidate trigger or to add some RequestFilterFields for example Posting Date on G/L Entry dataset. But that did not work – it resulted in an error when object was run. I guess those could be considered as destructive changes that Micosoft doesn’t allow for reportextension.
As there is a way to add code to OnPreReport and OnPostReport triggers, I added some code in the onPostReport trigger where based on the option from the request page, another report is run.
Then when I came to publishing – it worked fine after I gave up from “destructive” changes.
The only thing that you need to do after the extension is deployed is to point the report layout to the newly built in RDLC. This, of course, can be automated with some additional coding for the extension handling.
Here is the result – dataset and request page are extended:
The small demonstration reportextensions project is available in GitHub.
Seems like additive changes work nicely, but any other such as modification of existing columns or changing code in report trigger are consider as destructive and not supported.
So, this is not a story with the 100% happy end as there are more gaps that some of could get fit in the future. I would personally like txt2al tool to be enhanced with reportextension so to make migration pains easier and also some magic with the layout please!
At the end, I just want to briefly mention some other features that took my attention, but haven’t tested it yet:
Hope this joy will last long and similar long waiting improvements are just around the corner… just hope that the next steps of BC architecture modernizations and moving to .Net core won’t break the party!
Be free to reach me back about any technical questions about Dynamics Business Central.