Microsoft Dynamics AX2012 for Retail – Batch Number Customization

Issue Raised:

In Microsoft Dynamics Ax2012 Retail, items cannot be sold out with the Batch Id. If a Item is Batch-able, it cannot be consumed through POS.


1) Retail must be confiqured

2) Retail SDK must be Installed

3) Visual Studio respective version for SDK customization


Create a new blank operation button (Retail -> Setup->POS->ButtonGrid):

In my case I named as “BatchNumber“, this operation number is used by the blank operation class to catch the specific button click event.


Add the Batch Id on the product grid layout (Retail -> Setup->POS->screen layout):


Run the Register job to reflect the change on the POS layout (Retail -> Channed integration -> Channed database)


apply the job from download sessions.Once the job is applied, open the POS (respective store on which the job was run) and see the blank operation button is visible:


after the button is displayed, now its time to code behind the button.

Navigate Retail SDK and open the services project and go on the blank operation class and add the following code:


I added a new windows form in blank operation class to input the batch number,in my case I populate the dropdown(in the next blog I will demonstrate how to populate the INVENTBATCH  of POS database). you can take the textbox to give the batch Id and set “batchid = urTextBox.Text” in the above code.

the selected record on the product grid is get through the following piece of code:

SalesLineItem s = retailTransaction.GetItem(operationInfo.ItemLineId);

this is the item in which you need to give the batch Id.

build the code copy the dll and place it to the POS dll folder.




Happy Daxing with Rizz 🙂

Download BlankOperation.dll


Dll must not be compatible for all the POS Versions. To use the code decompile it and use the code.


9 thoughts on “Microsoft Dynamics AX2012 for Retail – Batch Number Customization

  1. Hi Rizvan,

    your blog is awesome but is it full, as I am not able to complete the setup which you have explain you in your blog.
    I am not a developer so I cannot work on coding so what you have mentioned in your screen shot I am following the same.

    can you email me your entire solution for this.
    it will be much appreciated.

    thanks & regards,


    1. Hi husain,

      As I have mentioned in the blog that you need to customize the blankoperation Dll for achieving the task and make sure if you are entering the batch number manually than it is ok but what if you need to have the dropdown selection as mention in the screenshot than you must follow the steps given in my other blog( to sync batch number table (InventBatch) to POS DB.
      blank operation dll mailed to you.

      Rizwan Khan


  2. Hi Rizvan
    i’m newbie developer in ax in its look so helpful i flow your steps but now i’m stuck
    i flow your steps until Navigate to Retail SDK in blank operation but i didn’t find this class (BatchIdDialog) to write the code on i have this class (blank operation) can you please learn me how or provide me dll file please


    1. Hi Mohammad,

      I have updated my post with the dll link, you can have it from the provided link. And BatchIdDialog is not the out of the box class I added the windows form to get the input from user for the BatchId. In my case I am filling the dropdown control of the respective Item’s BatchIds.

      Rizwan Khan


      1. hey Rizwan Khan
        Thank you very much for helping so you mean is (BatchIdDialog) is normal windows form
        so can i take expiration date date rather than BatchId?


  3. and in what event must be put that code in load form or what?
    can you please provide me what’s Contains that form please
    thanks again


    1. Hi Mohammed,

      I don’t know what really you are trying to achieve but as according to my code its just the windows form design which contain the dropdown selection and ok button and which is initialized when the blank operation button is clicked. Connect with me over skype (rizwan.khan133) if you need to discuss any solution for your requirement.

      Rizwan Khan.


      1. hey Rizz Khan
        thanks for responding
        i was thinking to let me select batch number of selected products when customers buy according to expiry date.



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