QR code and Bar code creation in Dynamics 365 Finance and Operation (F&O) using x++ code

QR code and Bar code creation in Dynamics 365 Finance and Operation (F&O) using x++ code

Hey guys. In this article, I will show you how to write the code to create your own QR code and Bar code in Dynamics 365 Finance and Operation using x++ code.

I believe many of you are struggling with this problem and may not be?getting the right one at right time. So, this gift is for you.?

What you need to do?

  1. Create two simple classes, one is for QR code creation helper and other is for Bar code generation helper and paste the below code in it.?
  2. Now, you can use these classes where you need to add the bar code or Qr code by simply calling it.?

Bar code

/// <summary
/// Barcode creation helper
/// </summary>
public class AA_CreateBarcodeHelper
{
? ? /// <summary>
? ? /// Barcode creation
? ? /// </summary>
? ? /// <param name = "barcodeText">Pass the text that you want to scan while scanning Bar Code</param>
? ? /// <returns>Barcode</returns>
? ? public static BarCodeString showBarcode(str barcodeText)
? ? {
? ? ? ? Barcode barcode;


? ? ? ? barcode = Barcode::construct(BarcodeType::Code39);
? ? ? ? barcode.string(true, barcodeText);
? ? ? ? barcode.encode();


? ? ? ? return barcode.barcodeStr();
? ? }
}

>        

QR code

/// <summary
/// QR code creation helper
/// </summary>
public class AA_CreateQrCodeHelper
{
? ? /// <summary>
? ? /// Generate QR code?
? ? /// </summary>
? ? /// <param name = "qrCodeText">Pass the text that you want to scan while scanning QR Code</param>
? ? /// <returns>Bitmap</returns>
? ? public static Bitmap generateQRCodeFromBase64(str qrCodeText)
? ? {
? ? ? ? Bitmap qrCode;


? ? ? ? EFDocQRCode_BR generateQR = new EFDocQRCode_BR();
? ? ? ? generateQR.parmErrorCorrectionLevel(QRCodeErrorCorrectionLevel::Medium);


? ? ? ? try
? ? ? ? {
? ? ? ? ? ? qrCode = generateQR.generateQRCode(qrCodeText);
? ? ? ? }
? ? ? ? catch (Exception::CLRError)
? ? ? ? {
? ? ? ? ? ? warning("@ApplicationSuite_Localization:QRCodeIsDamaged");
? ? ? ? }


? ? ? ? return qrCode;
? ? }


}>        

Happy Learning,

Syed Amir Ali.

Kamesh Kamalanathan

Lead Digital Engineer at Sonata Software

1 年

Thanks for posting this article

回复
Muhammad Bilal

SSE - Senior Dynamics 365FO Developer at Servis Industries Ltd.

1 年

Thank u Amir bhai.. You r great

回复

要查看或添加评论,请登录

Syed Amir Ali的更多文章

社区洞察

其他会员也浏览了