web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

How to use Business Event in codeunit 2000000xxx ?

(0) ShareShare
ReportReport
Posted on by 215

Hello,

We are migating our code from NAV 2018 to Business Central 17.5. We are facing a problem : we used to call the procedure FindPrinter() in codeunit 1, but this codeunit no longer exists. Instead, it has been split in several codeunits, some in the system app, others in the base application app. The codeunit 2000000005 "Reporting Triggers" contains the Business Event GetPrinterName. There is an event subscriber to this Business Event in codeunit 44 ReportManagement, containing an event publisher.

My purpose is to call the procedure GetPrinterName at a specific moment of my code. The Microsoft documentation says (here) :

  • "Currently, we don't recommend that code subscribes to the events in the new system codeunits 2000000001..2000000010 directly. Although not blocked, it might be in a future release. Instead, you should subscribe to one of the integration events."

How should I call the GetPrinterName procedure in that case ? I could susbscribe to event publsiher in codeunit 44, but I won't be able to launch the procedure when I want to, only to run my additionnal code when the procedure is called. Shall I call the procedure GetPrinterName of the Business Event in codeunit 2000000005 ?

Thank you

  • Suggested answer
    THE Italian Profile Picture
    Microsoft Employee on at

    You can call that procedure, if nothing fits your needs.

    Beside that, if there is an integration event that you are in need of, you might ash this through GitHub as it is any normal request to add a publisher event in 1st party app.

  • Magicrevette Profile Picture
    215 on at

    Thanks for your answer.

    So I shall call the procedure GetPrinterName in the BusinessEvent in the codeunit 2000000005 Reporting Triggers, if I want to use this procedure ?

  • Verified answer
    THE Italian Profile Picture
    Microsoft Employee on at

    Whatever fits you best with your development. 

    Test it both onpremise and in saas and that's all.

    Just FYI, I will using something similar in a future blog to catch server side useless printers for server side printing to Codeunit and I am subscribing to OnAfterGetPrinterName to return an error message if these are not allowed (e.g. Print to PDF, XPS printers, FAX, etc.)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 757 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 451 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 391 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans