Monday, 1 November 2021

Generate QR code in Business Central using Third party Webservice link

AL Code as per below

Create New Report with having barcode image.


In RDL design add image type control and put the barcod2 variable into that like we do normally for Picture control.


report 50999 QRCodeList
{
    Caption = 'QRCode List Report';
    UsageCategory = Administration;
    ApplicationArea = All;
    DefaultLayout = RDLC;
    RDLCLayout = '.\Report\QRCodeList.rdl';
    dataset
    {
        dataitem("Sales Header"; "Sales Header")
        {
            column(No_; "No.")
            {

            }
            column(temp; barcode2)
            {

            }
            trigger OnAfterGetRecord()
            begin                
                barcode2 := InitArguments("No.");
            end;
        }
    }


Global Variable

  var
        BarCode2: text;



local procedure InitArguments(ItemNo: text): text
    var
        BaseURL: Text;
        Base64Convert: Codeunit "Base64 Convert";
        TempBlob: Codeunit "Temp Blob";
        TypeHelper: Codeunit "Type Helper";
        client: HttpClient;
        response: HttpResponseMessage;
        InStr: InStream;

    begin
        client.get('https://barcode.tec-it.com/barcode.ashx?data=' + itemno + '&code=QRCode', response);
        TempBlob.CreateInStream(InStr);
        response.Content().ReadAs(InStr);
        BarCode2 := Base64Convert.ToBase64(InStr);
        exit(BarCode2);
    end;



Run the report in BC and see the output, it will give you a QR Code as image.



Extension Unpublished/Uninstalled history required in BC Production environment

  There is a situation when someone can uninstall or unpublish any APP extension from the extension management in Production environment, th...