Well if you’ve come here you probably need to use the old report.run(50000,FALSE,FALSE,Rec) approach, but sadly we do not have those FALSE parameters available anymore, not in the same way we used to in the NAV days anyway. Since Business Central SaaS is running the the MS Cloud, and the way you access it is mostly web based (including the app itself, which is for the most part just a web front app), if you try to set up the printer selection window you might find yourself out of luck.

I am sure Microsoft will provide a new and updated way to use the Printer Selection window in a similar way we used to, but until then I had to find an alternative. After searching a while and taking tips from here and there, I ended up creating an integration with PrintNode.

PrintNode provides a print service where you need to install their app on the computer where the printers are installed

Once you have it installed, just open it up with your previously created account and select the printers you want to integrate.

After that, you can check the code in my GitHub repository where it’s available.

https://github.com/jcastrofer/PrintNode-Business-Central-Integration

Once you have the App installed, you can go with the setup window (you’ll need an API key, create yours here).

PrintNode Integration Setup window

After the correct setup you can get the printers linked to your account by going to the “PrintNode Printers” window.

PrintNode Printers window

After that just set a default printer in the Setup window, and go to the “PrintNode Printer Selection” window to complete your requirements, just like the standard Printer Selection window.

PrintNode Printer Selection window – You do not need to the set the printjob options

In order to integrate your develoments with this app, create a dependency to this and use it freely.

In order to create the dependency, in your app.json, add the dependencies to this extension. For more information on how to do that, check this link: https://www.hougaard.com/how-to-reference-another-extension-from-an-extension/

Once you’re done, just declare a variable in your code, Codeunit: “PrintNode Management”, and call the SendReportToPrintNode(ReportID: Integer; RecVariant: Variant; PrintJobTitle: Text) function and call it whenever necessary. In case you need to print a special kind of report, you can generate it and save it in a Blob (TempBlob). After, just call the SendReportBlobToPrintNode(ReportID: Integer; TempBlob: Record TempBlob; PrintJobTitle: text) function.

Once you’re done, just declare a variable in your code, Codeunit: “PrintNode Management”, and call the SendReportToPrintNode(ReportID: Integer; RecVariant: Variant; PrintJobTitle: Text) function and call it whenever necessary. In case you need to print a special kind of report, you can generate it and save it in a Blob (TempBlob). After, just call the SendReportBlobToPrintNode(ReportID: Integer; TempBlob: Record TempBlob; PrintJobTitle: text) function.

I hope this solution helps some of you. Best of luck.

La entrada Report Selection on Business Central SaaS or Cloud Server Side Printing OnPremise se publicó primero en José Castro's blog.