ax / d365fo – Adding Barcode to a Report

First, create a method like the following either on your Report element or in the relevant Section.

display str 30 barcodeRefNum()
{
    Barcode     barcode;
    ;

    barcode = Barcode::construct(BarcodeType::Code128);
    barcode.string(true, custPackingSlipJour.packingSlipId);

    return barcode.barcodeStr();
}

Note the BarcodeType enumeration that provide you with options other than 128.

Then, add a String control to your report and use your new method as the data method.  You could also have attached the display method directly to the underlying table if that’s better for you.  Finally, set the width, height, and alignment, and finally the font to your required symbology, i.e. “BC C128 Wide”.  Code 39, 128, UPC, and several others come with the Dynamics AX client.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s