Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support teams Worldwide

AX for Retail: Two Bug Fixes for the Blank Operation “Sell Item”

AX for Retail: Two Bug Fixes for the Blank Operation “Sell Item”

Rate This
  • Comments 10

[Update 2012-06-21]  As mentioned earlier, the 2012 version of the support class has a different issue than the two mentioned here.  The good news is that it is much more simple to add an item to a transaction in the Blank Operation for 2012; you don't need to use the support class at all.  One line of code does it for you:

            Application.RunOperation(PosisOperations.ItemSale, "0110");


Or you can send in the item number from the Parameter defined on the Blank Operation button:

            Application.RunOperation(PosisOperations.ItemSale, operationInfo.Parameter);



As I mentioned in my previous article about the Blank Operation, there are a couple issues with the support classes provided with the blank operation.  Specifically, there are two bugs in ItemSale.cs.

The ItemSale.cs file contains the ItemSale() class.  This class provides a quick way to add items to the transaction via code.  To call the class you would use code similar to the following:

            ItemSale itemSale = new ItemSale();
itemSale.SellItem(ref posTransaction, "F-100006", 2);

Fix 1:

The first issue happens if you are adding an item to a brand new transaction using this method.  When creating a new transaction, a “blank” customer needs to be added otherwise the tax engine will not calculate taxes properly.  Add the bolded lines of code to correct the issue:

                posTransaction = new RetailTransaction […]

// initialize with empty/blank customer
                LSRetailPosis.Transaction.Customer customer = CustomerSystem.GetEmptyCustomer();
((RetailTransaction)posTransaction).Customer = customer;
((RetailTransaction)posTransaction).InvoicedCustomer = customer;
TransactionSystem transSystem = new TransactionSystem(posTransaction);

Fix 2:

The second problem is due to the way that the BarCode object gets initialized which could cause an unhandled exception downstream.  The simple fix here is to comment out the two lines of code that initialize the object and always send a null value instead:

            // Creating a barcode info object with the item ID
            //BarcodeInfo barCodeInfo = new BarcodeInfo();
            //barCodeInfo.BarcodeId = itemID;

BarcodeInfo barCodeInfo = null;

If you plan on programmatically adding items to the transaction using this method, these two fixes should help you out.

Leave a Comment
  • Please add 4 and 5 and type the answer here:
  • Post
  • Hi Shane!

    Thank  you for excellent postings.  Is there any updates regarding the additional issues found in SellItem?

    Best Regards


  • Thanks for the follow-up, Lars.

    The issue with the 2012 version of the blank operation has to do with an interface that was changed between the core POS application and the Blank Operation plug-in.  The product team is currently evaluating the implications of changing that interface back so that this will work.  I will definitely update here when I have a solution.

  • Hi Shane,

    Some time has now passed, and I wonder if this issue perhaps was fixed in CU3 update of if you have any other updates?

    Best Regards,


  • Hi Lars - take a look at the edit at the top of the post (2012-06-21) about a much easier way to do this in 2012.  The two bug fixes for the support classes are irrelevant in 2012 because the support classes are no longer needed to add items programmatically.  Just use this line of code to add an item to the transaction:

    Application.RunOperation(PosisOperations.ItemSale, "0110");

  • Hi, how can I post a transaction to Database from Blank Operation, Any help on this please

  • Tahir, please see my response in the comments of the other Blank Operation post:

  • hi shane, how can i recall a suspended transaction in PO2012 CU1 through blankoiperations by using:

    Application.RunOperation(PosisOperations.ItemSale,"item id");

    i want to add a full suspended transaction to the pos screen (main)

    pls reply asap

  • Hi Shane, I want to add a free item in transaction by Calling Transaction.SaleLines.Add() method in R3 but there is some error thrown by application and free item could not add.

    Please help.

  • Hi,

    I would reset process forms ( customer and transaction) without using the function avoidTransaction or avoidPayment. I rather seeks the same behavior after payment of transaction..

    Do you have an idea about the operation , service, trigger to use the code to reset the forms?

    (AX 2012 R3 CU8)

  • When i write TransactionSystem, visual studio say :  the type or namespace 'Transactionsystem' could not be found


    using System.ComponentModel.Composition;

    using System.Text;

    using System.Windows.Forms;

    using LSRetailPosis;

    using LSRetailPosis.Transaction;

    using LSRetailPosis.Settings;

    using LSRetailPosis.Settings.FunctionalityProfiles;

    using Microsoft.Dynamics.Retail.Pos.Contracts;

    using Microsoft.Dynamics.Retail.Pos.Contracts.BusinessObjects;

    using Microsoft.Dynamics.Retail.Pos.Contracts.BusinessLogic;

    using Microsoft.Dynamics.Retail.Pos.Contracts.DataEntity;

    using Microsoft.Dynamics.Retail.Pos.Contracts.Services;


    posTransaction = new RetailTransaction(ApplicationSettings.Terminal.StoreId, ApplicationSettings.Terminal.StoreCurrency, ApplicationSettings.Terminal.TaxIncludedInPrice, this.Application.Services.Rounding);

                           // initialize with empty/blank customer

                           LSRetailPosis.Transaction.Customer customer = (LSRetailPosis.Transaction.Customer)Application.BusinessLogic.CustomerSystem.GetEmptyCustomer();

                           ((RetailTransaction)posTransaction).Customer = customer;

                           ((RetailTransaction)posTransaction).InvoicedCustomer = customer;

                           TransactionSystem transSystem = new TransactionSystem(posTransaction);

                           //ITransactionSystem transSys = new Application.BusinessLogic.TransactionSystem;



Page 1 of 1 (10 items)