There can be many blog posts about how to use 2D barcodes (QR codes, mainly) within Dynamics 365 Business Central but not that many are using an Invoice to demo them.
I will try to have this gap fixed at my style.
First things first.
Report (aka clone the report) or Report Extensions?
Report Extensions have the (big) advantages of
If you have to simply printout one or more field header values (e.g. the invoice No. – e.g. Sales Header No. -) then a Report Extension is the right way to go. Silent, swift (and deadly), like the US Marines motto.
Few lines of code and you do not have to maintain the whole report, keep extension file smaller, etc. Simple as 1,2,3.
When it comes to let’s say print out
Then it gets just a bit more complicated and it falls back to Amleth’s dilemma: to clone or not to clone?
Writing universal code, would lead in trying to use Report Extension as much as possible BUT if developing a Report Extension would require to re-calculate all totals only for the sake of having these printed in QR Code then this is a no go. This might have performance implications.
So that, to go straight to the point, the more data are needed to be stored in QR Code that are not directly bounded to a table data item, the higher are the chances to clone the original report and add QR Code there.
How to achieve that? (Considering 19.1 and W1 Localized version)
and the following OnAfterGetRecord trigger and its code to generate the Barcode string and its equivalent encoded value
NOTE: Be absolutely sure that EncodedTotals has IDAutomation2D fonts (exactly as it is written)
(NOTE: BarcodeString has been jus added to showcase what is encoded in the QR).
If you deploy this extension then you can run this directly using Tell Me feature or you could also think to add a simple codeunit that subscribe to OnAfterSubstituteReport event in ReportManagement codeunit as written officially in Substituting Reports - Business Central | Microsoft Docs.
Below a screenshot of the report output. Try out with your device to scan it.
This might be due to one or more of the following
a. You are not using a W1 report but a localized one
b. You are not using exactly minor version 19.1
In any case the solution is super easy: remove all directives.
I have followed the process you have highlighted above. Though am getting an error of [tag:endif] directive expected. Where have you ended the directive in step number 3?
Sohail Ahmed
1,063
YUN ZHU
1,002
Super User 2025 Season 1
Mansi Soni
780