Inkey Solution Logo


How to Get Barcode Value in Dynamics 365 Mobile App

, July 20, 2023 1143 Views

Microsoft Dynamics 365 provides the ability to scan the barcode from the mobile phone and tablets. For that you can enable “Barcode Scanner” control on any single line of text field from the form.

One can use this Barcode Scanning option to access the data easily. Let’s take an example to understand it in a better way.

One organization is having Dynamics 365 to process their Orders. They want the ability to capture Product on the Order Line table by scanning the Barcode from their wide range of Products using the mobile application of Dynamics 365. To accomplish this, we can follow the below steps.

First, add one single line of text field on Order Product form named Barcode in Order Product table. After adding a field, open the field properties of the same field and then click on “Add Control”.

add control

Then select the Barcode Scanner control and click on “Add”.

Microsoft Dynamics 365 - Mobile App Barcode scanner

Enable it for Phone and mobile.

scan barcode through dynamics 365

Once you save and publish the form, you will be able to see the barcode scanner control.

Microsoft Dynamics 365 - Mobile App Barcode scanner

Let say in dynamics, Products are already stored with their barcode numbers. Now we need to populate the Product lookup present on the Order Line based on the Barcode value captured from the mobile camera.

Microsoft Dynamics 365 - Mobile App Barcode scanner

To populate the Product, we need to write JavaScript function that trigger on change of the Barcode field. Microsoft provides different function to get the value when we use scanning feature from the mobile camera.

Xrm.Device.getBarcodeValue() will give us the scanned barcode value when our function triggers from the mobile app.

var formContext = executionContext.getFormContext();
    var barcode = formContext.getAttribute("advic_barcode").getValue();
    if (barcode == null && Xrm.Device != null) {
        function success(result) {
          barcode = result;
        function (error) {
          Xrm.Navigation.openAlertDialog( {text: error.message} );

As mentioned in above function, in success call back result we can get the barcode value.

Hope this helps!

ATM Inspection PowerApp to ease ATM inspection and report generation process.

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.



INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

Leave a Reply

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

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?