Please wait
Talk to Expert
Microsoft Dynamics Business central

How to Create QR-Code in Business Central?

Configure Business Central Container in Docker. 01

In Business Central, the “Create QR Code” feature enables users to generate QR codes directly within the system. QR codes are two-dimensional barcodes that can store various types of data, such as text, URLs, contact information, or product details.

With the “Create QR Code” functionality, users can typically specify the type of data they want to encode into the QR code, such as a web link, contact details, or a specific text message. Business Central then generates the QR code image based on the provided data.

Step: 1

First We Need To Add A Column For QR-Code So let’s Add Column In Our Report.

 

Step: 2

Now Create One local procedure Or Add bellow Variables:

 

Step: 3

First we have to Need To Clear All The Variables You Can See In bellow Image:

 

Step: 4

We should have Use CalcFields For Get Value Of Amount Including Vat From Sales Invoice Header.
{We Add This Value In Qr Code And We Are Combine Date And Time So for Combining Date And Time We Use A Function And It’s Provide By Microsoft ( CreateDateTime) You Can See In bellow Image.}

 

Step: 5

As You Can See In first Image, we must have to Add Text Variable CombinedString.
This Variable use For Store Data Which We Need To Show In Qr Code. You Can See In bellow .
Var
CombinedString : Text ;
Use “ + “ For Add Any Other Datils In Qr Code,
CombinedString := ‘seller_name=’ + CompanyInfo.Name + Seperator + ‘Company&tax_number=’ + CompanyInfo.”VAT Registration No.” + Seperator + ‘total=’ + Format(Header.”Amount Including VAT”) + Seperator + ‘tax_amount=’ + Format(TotalTax_Ldec) + Seperator + ‘date=’ + Format(CombinedDateTime);
[Noted: – You Can change This Value as Per Your requirement.]

Step: 6

Now next to follow, go to Store This CombinedString In Other Text Variable Which Is GeneratedAPI And This Link Is Use For Store Value In Qr Code, You Can See In bellow Image .

 

Step: 7

Now Use “Temp Blob” CodeUnit For Create A INSTR. For Create Instr have to use CreateInStream Function And It’s Provide By Moorcroft Code As Per bellow.
TempBlob.CreateInStream(InStr);

 

Step: 8

Now Use Response Variables As You Can See In first Image OF Variables.
Use This Variable With Contact & ReadAS Functions Which Is Default Functions.
Use that Functions In this Way,
response.Content().ReadAs(InStr);

 

Step: 9

Now We Can Need To Add One Global Variable Which Is Barcode2 And This Is A Text Variable.
Now next to do is to Store Value In This Variable. If You remember We can Add One Variable Base64Convert Which Is a Codeunit “Base64 Convert” And We Use One More Function And That Is Including In Base64Convert Codeunit Which Is ToBase64 That Function IS Convert Barcode2 In Instr And Now In The Last We Can Exit Barcode2. Code as Per mentioning bellow ,
BarCode2 := Base64Convert.ToBase64(InStr);
exit(BarCode2);
you Can See Above variables code here.

 

Step: 10

Now, We Need To Add This field In Report’s Layout. It’s Same Like Add Picture So First We Can Add One Image Box. When we Select Image Box We Got This type Table Which Is Image Properties.
So First We should To go “Select The Image Source” And Select Database Then you Have Two Row In bellow Which Is
I. Use This Field:
II. Use This MIME Type:

Like This,

1: Use This Field:
In First Row We Can Select Our Barcode Column Which IS Add In Report ‘s Code You Can See that Column In First Picture In This Blog
2: Use This MIME Type:
Now, Select In Use This MIME Type It’s For Image type Like When You Go For That ,You Have Five Option’s Which Is bellow
I. image/bmp
II. image/jpeg
III. image/gif
IV. image/png
V. image/x-png
So We Can Select From Them And It’s depending On Your Picture Type So In Our Case We Can Select Second Option Which Is image/jpeg As Per bellow Image

 

Now Set This Image Acceding You And Then Save You Layout And Build And Run Your Report And Check output

Step: 11

Now Open Business Central And search You Report’s Name. And Open Request Page Now Select Preview & Close And Your Report Is Open As You Can See In Your Report Output And You Got Your QrCode Is Ready. Now Scan Your Qr-Code In Qr-scanner App And You Get your Value Which you insert In code. Now Check Our QrCode So That Is My Qr-Code.

 

And I Am Using The “E-Invoice Qr Reader“ For All Of My Qr Code Scanning. And When We Scan This Qr-Code So I got This Type of Output Which Is You Can See In bellow Image.

 

Thank you for investing your time to read our blog! We’re passionate about sharing valuable insights to help you navigate the world of Business Central.

If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.

Let’s turn your vision into reality together!


Comments