Barcodes & QRCodes in Dynamics 365 Business Central SaaS

Testing Barcodes & QR Codes in Dynamics 365 Business Central SaaS

MY QUESTION TO MICROSOFT

“I would need to understand (and to have some examples if possible) what is the best solution to use Barcode in MSDYN365 SaaS since it is not possible to install fonts on MSDYN365 SaaS to date by, In this case I would need the GS1-128 barcode font

Example with barcode font GS1-128 (ex EAN-18)

Barcode in RDLC and Word Layout Reports

We would need to use both RDLC and Word Layout reports if possible (for WL I tried to use fonts embedded in DOCX but I did not print them, system in SaaS replace the embedded fonts barcode during printing)

I have seen these solutions \ workarounds in the forums\internet

  • Barcode Font in Business Central
  • Barcode implemented through API and without .Net Variables.

https://community.dynamics.com/business/f/758/t/299392

OFFICIAL ANSWER FROM MICROSOFT

.NET Azure Function or wait for Spring 2019

“Standard barcode font are not available in Dynamics 365 Business Central SaaS, the solution proposed in the blogs looks quite possible.”

Basically these could be:

  • Find out in the market a service – if exists – where you send a string and it returns the barcode image (encapsulated in a JSON array, or in another flavor)
  • Create a .NET Azure Function that takes a string and return the barcode image

 

#1 – BARCODE WITH “JSONMethods” and “RESTWebService”

From GITHUB Microsoft AL Question: “What is the Best Practice for creating 2D/3D Barcodes in Extensions without .NET? Currently we create an Image which will be Stream as Blob to RDLC Report Layout.”

https://github.com/Microsoft/AL/issues/744

“JSONMethods” and “RESTWebService”

  • Original AL Code taken from Kaufmann (GitHub), few modified for compatibly to Business Central C SaaS October’s release (area, captions, permissions etc.)

https://github.com/ajkauffmann/ALWebServiceExamples

Free Barcode generator http://www.barcodes4.me/

  • I Added a RDLC report to test barcode reading

Elements

  • Barcode Tables
  • Barcode Pages
  • Barcode RDLC Report
  • Codeunits for JSONMethods and RESTWebService
  • Permissions Sets

On “Barcode” Page

  • Click on “Generate Barcode” button

  • Barcode picture will be generated

RDLC Report

  • Report “Barcode List” print Barcode Pictures for reading testing

 

TEC-IT.COM

With “Long Barcodes”, you can have some reading error; in this case, you can use this other Free Barcode generator by “Tec-it.com”.

https://www.tec-it.com/en/software/Default.aspx

Example creation of GS1-12 font On-Demand

https://barcode.tec-it.com/en/EANUCC128?data=122RS_BarGS1128

Example of Direct Download from generated link

https://barcode.tec-it.com/barcode.ashx?data=122RS_BarGS1128&code=EANUCC128&translate-esc=on&dpi=96&dataseparator=&download=true

TEST WITH Tec-it.com AND WORD LAYOUT REPORT

  • Change “Arguments.URL” in “InitArgument” Local Procedure in this way:

local procedure InitArguments(var Arguments: Record RESTWebServiceArguments temporary; Barcode: Record Barcode)

var

BaseURL: Text;

TypeHelper: Codeunit “Type Helper”;

begin

BaseURL := ‘https://barcode.tec-it.com/barcode’;

Arguments.URL := ‘https://barcode.tec-it.com/barcode.ashx?data=’ + TypeHelper.UrlEncode(Barcode.Value) +

‘&code=Code128&multiplebarcodes=false&translate-esc=false&unit=Fit&dpi=96&imagetype=Png’;

Arguments.RestMethod := Arguments.RestMethod::get;

end;

Font dimensions: you can define dimensions (DPI, WIDTH, HEIGHT) in this way: 

<img src=’https://barcode.tec-it.com/barcode.ashx?data=ABC-abc-1234&code=Code128&multiplebarcodes=false&translate-esc=false&unit=Px&dpi=96&imagetype=Gif&rotation=0&color=%23000000&bgcolor=%23ffffff&modulewidth=2&height=200‘ alt=’Barcode Generator TEC-IT’/>

  • Create a new Word Layout for report

BARCODE – WORD LAYOUT REPORT – DESIGN MODE

Launch the Word Layout Report

RESULTS

  • Printed from Dynamics 365 Business Central SaaS

Source Code link https://github.com/rstefanetti/AL-Samples/tree/Barcode_AL

 

Example of “Production Order Report” in Word Layout with Barcode

 

ASPOSE.BarCode

Another great resource is ASPOSE.COM

https://www.nuget.org/packages/Aspose.BarCode/

This Technology Based on Entity Framework

“Entity Framework is Microsoft’s recommended data access technology for new applications.”

https://www.nuget.org/packages/EntityFramework/

https://github.com/Microsoft/AL/issues/2104

 

#2 – BARCODE AND QRCODE WITH AZURE FUNCTIONS (FUNCTIONS APPS)

2A – TESTING “AZURE FUNCTIONS”

What are Azure Functions?

Azure Function (Function App) is one elegant way of replacing your .NET interoperability code with something else is by using Azure Functions”, as defined by Microsoft (updated definition): Azure Functions is a serverless event driven experience that extends the existing Azure App Service platform. These nano-services can scale based on demand and you pay only for the resources you consume.”

https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview

Azure Functions in Dynamics NAV and Dynamics 365 Business Central

Great Demo “How-to” Call Azure Functions on Dynamics NAV\Business Central on Vjeko Post http://vjeko.com/invoking-azure-functions-al/

  • Example: Create a New Functions Apps

  • Create a new HTTPTrigger Function

Calling Azure Function in AL

  • Example in Microsoft AL

Define Variabiles To call the Defined Azure Functions

  • Client
  • Content
  • Response

Demo objects uploaded on GITHUB

Link https://github.com/rstefanetti/AL-Samples/blob/Barcode_AL/Barcode.zip

 

2B – TESTING “BARCODES AND QRCODES” WITH AZURE FUNCTION

Azure Functions is a serverless event driven experience that extends the existing Azure App Service platform. These nano-services can scale based on demand and you pay only for the resources you consume.”

SCENARIO: “Create a .NET Azure Function (Azure App) that takes a string and return the Barcode or QR Code images”

Generate Dynamic Barcode Image in Azure Function using Visual Studio, Entity Framework and “Aspose.Barcode”

nice link about Barcode with Entity Framework and Azure Function http://foyzul.com/generate-barcode-image-in-azure-function-using-visual-studio-entity-framework-and-aspose-barcode/

Entity Framework

https://www.nuget.org/packages/EntityFramework/

Create vCard QR Codes using Azure Functions

nice link about direct QR Code Generation https://carlos.mendible.com/2016/08/28/create-vcard-qr-codes-using-azure-functions/

 

#3 – BARCODE SCANNING WITH POWERAPPS

VERY INTERESTING ARTICLE:

  • Create a Barcode scanning app in few minutes

https://powerapps.microsoft.com/it-it/blog/make-barcode-scanning-apps-in-minutes/

7 thoughts on “Barcodes & QRCodes in Dynamics 365 Business Central SaaS

    • 15 March 2019 at 1:39 PM
      Permalink

      Great!
      Thanks.

      Reply
  • 16 October 2019 at 11:44 AM
    Permalink

    Hello Sir,

    I am Currently working on Reports with Barcodes in Business Central . While running report in Business Central Web Client the Barcodes are not showing in that Report, but if I run the same Report in Windows client the barcodes are showing properly.

    Note :
    1.I Installed Business Central in My local sytem(Local server).
    2. I am Developing an Application in Business Central On-premises.
    3. I installed all required Barcode fonts in my local system.

    Could you please give me suggestion, how can I resolve this issue.

    Thank you.,

    Reply
  • 14 November 2019 at 3:39 PM
    Permalink

    Wow, it is a bible for barcoding in NAV.
    Looks very helpful.

    Reply
  • 11 December 2020 at 10:39 AM
    Permalink

    Thanks for this very useful post.
    Unfortunately, barcodes4.me have announced that they are withdrawing the service as of 1st January 2021, so anyone who’s used that will need to change to one of the alternatives.

    Reply
  • 6 January 2022 at 12:45 PM
    Permalink

    Very useful,

    Thank you very much Roberto!
    💪

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.