Batch number Scanned from Barcode – Retail Customization,Microsoft Dynamics AX2012 R3


BatchId must be filled/autoset when Item is scanned from barcode if the Item is Batchable in Retail POS of Microsoft Dynamics AX2012 R3.


In this blog we will be using the “Real Time Service”to get the BatchId from barcode, we also  customize the barcode table (InventItemBarcode) to add the BatchId field as shown:



Now when we will pass the itemId with its Barcode the Real time service will return the batchId associated with it.

We will be using “RetailTransactionServiceEx” class for developing the custom real time service methods as it is not recommended to change the base real time service class of AX i.e. “RetailTransactionService”:


Now we need to call this real time service method into barcode dll to get the batchId and attach it to the current sale time.

Retail Sdk –> POS Plug-ins –> Services –> Barcodes (ProcessBarcode())

Barcode dll

from “InvokeExtension” the “RetailTransactionServiceEx” class method is called, in our scenario “getBatchId” is the rts method.

The processBarcode method is called all the time when the user enters the product number as well, to run our logic only in the case of barcode I have put the logic

“if (barcodeInfo.Found == true)” and it gets the Batch Id from rts call and insert it into the table which will be cleared from the “post sale trigger”(ItemTriggers.PostSale) after setting the Batch Id in the current sale buffer:


once done with the code build the dlls and replace it to the POS Client Folders, for triggers replace the ItemTriggers dll in the Triggers folder and for Barcode replace it from Services Folder.

Now open the POS store and test the item through scanning through Barcode the cart must have the BatchId which is present in AX on its Barcode.


In this customization, we are dealing with the Real Time Service which is not a good example of getting the batch Id from the respective table. This is just to give the flavor of how we can handle the batchId from scanner too.

The proper way is to sync the InventBatchId Field from AX to POS DB,similarly as mention in my blog ( So, that if the real time services are not working even if the POS transactions will not be effected.


Happy Daxing with Rizz 😉

2 thoughts on “Batch number Scanned from Barcode – Retail Customization,Microsoft Dynamics AX2012 R3

Leave a Reply

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

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

Google photo

You are commenting using your Google 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