Hi Readers,
I hope you are having a great day!
Today, we'll talk about another interesting topic of Business Central and that is, how you can use the same action and its properties that has a Standard Report and replace it with your own Custom Report and this can be done just by using simple Events. How cool is that!
Let's get started!
As you might know, standard reports cannot be changed in Business Central. So if there are any changes required we have to create a new al file and a report layout.
To know more about it, visit my other blog: https://jyotsnanav.blogspot.com/2020/07/creating-new-report-and-modifying.htmlTo overcome this, we will use a Publisher OnAfterSubstituteReport from the Codunit Codeunit 44 – ReportManagement and subscribe to this Publisher.
If you don't know how events work, refer: https://jyotsnanav.blogspot.com/2020/05/publishing-events-raising-events-and.html
Here, we'll take an example of Item Card. It has a report action 'Item/Vendor Catalog' and a has a Report Item/Vendor Catalog on its RunObject. But I want to have my Custom report on the action instead since there are layout and code changes.
So I will create a Codeunit ReplaceStandardReport (Quick tip: You can use the same codeunit for this functionality so that your Workspace is segregated categorically and systematically) and a Subscriber of the mentioned publisher, as shown below:
And that's it!
Now whenever you'll run your Action, it will be your Custom report. This saves a lot of time and energy since you need not extend page, create a new action or assign properties.
Note: You can only use this if your Report is on RunObject (and its static methods) and not when it is declared as a Variable. For situations like these, you'll either have to use a publisher if it raised on the action and subscribe to it. Otherwise, you'll have to create a new action and that will have your custom Report and you can hide the standard action.
I hope that this blog was helpful. Have a great day and Stay tuned for another one!
I'm Абрам Александр a businessman who was able to revive his dying lumbering business through the help of a God sent lender known as Benjamin Lee the Loan Consultant. Am resident at Yekaterinburg Екатеринбург. Well are you trying to start a business, settle your debt, expand your existing one, need money to purchase supplies. Have you been having problem trying to secure a Good Credit Facility, I want you to know that Mr Benjamin will see you through. Is the right place for you to resolve all your financial problem because am a living testimony and i can't just keep this to myself when others are looking for a way to be financially lifted.. I want you all to contact this God sent lender using the details as stated in other to be a partaker of this great opportunity Email: 247officedept@gmail.com Or WhatsApp/Text +1-989-394-3740.
ReplyDeletevery helpful
ReplyDeleteHappy to help! :)
DeleteSMB ERP Solution is a Microsoft Silver Partner. We provide Supply Chain Management Solutions, Microsoft NAV, Microsoft Dynamics NAV, Microsoft Dynamics Business Central. Contact us info@smb-erpsolutions.com for more details. Check out our website for more detials- Dynamics NAV Upgrade
ReplyDelete