Generating QR Codes in Dynamics 365 F&O Using X++
Monal Rode
Data Analyst -Power BI, DAX, Excel Expertise, Technical Consultant - D365 F&O ERP
Recently, we have worked on a project in Dynamics 365 Finance & Operations where I needed to generate QR codes to include key invoice details like invoice date, time, amount, and seller information. Here's a quick overview of how we achieved this using X++.
Overview
1. Data Contract Class ('QRCodeContract'):
- This class stores all the invoice-related data, such as the invoice date, time, amount, and seller information. Each field has a corresponding parm method to get or set the data.
2. Helper Class ('QRCodeHelper'):
- This class uses the QRCoder library to generate a QR code. It creates a QR code with the provided invoice data and returns it as a binary container that can be saved or displayed.
3. Encoding Invoice Data:
The invoice data is encoded into a specific format using TLV (Tag-Length-Value) fields. Each piece of data, like the seller's name or the total amount, is tagged and converted into a byte array. These arrays are then combined to create the final QR code data.
This project was a collaborative effort. I’d like to thank my seniors who guided us through the complexities. Their help was crucial in completing this project successfully.