Microsoft Dynamics AX Support

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

AX for Retail 2012: Customizing the Comments in the Product Grid for Enterprise POS

The Product Receipt Grid in Enterprise POS (EPOS) has always shown additional lines of information under the main item line.  For instance, if you change item quantities, add an item that has a discount, or add comments to a line item, you will see lines like this in the grid:

2015-01-20 10_53_57-r3cu8retail - - Remote Desktop Connection

Note that the comments shown on the screen aren’t necessarily the same as would print on the receipt handed to the customer – they are shown on screen as temporary information to the operator (the customer will also see the grid if you are using a dual display).

In previous versions of EPOS, the information on these lines could not be modified or suppressed.  A recent hotfix added functionality to the CustomField plug-in to allow access to those lines.  This article will show you how easy it is to modify or even suppress the information that is displayed in the grid.  Note: for general information about the CustomField plug-in, see my previous article about custom fields.

Before you can customize the line information you need to make sure you have the following hotfix installed:

  • AX for Retail 2012 (Feature Pack):  KB 2976896 (6.0.1108.7037)
  • AX for Retail 2012 R2:  KB 2978483 (6.2.1000.8330)
  • AX for Retail 2012 R3: KB 2978483 (
  • AX for Retail 2012 R3 CU8:  No hotfix necessary, included in initial release

If you have the correct hotfix installed you will see the new PopulateItemReceiptPreviewText method in the POS Plug-ins\Services\CustomField\CustomField.cs file:

        /// <summary>
        /// Returns the ItemReceipt Preview Text.
        /// </summary>
        /// <param name="previewComments">The preview Comments.</param>
        /// <param name="posTransaction">The pos transaction.</param>
        /// <param name="saleLineItem">The sale line item.</param>
        /// <returns>List[comments]</returns>
        public IDictionary<string, string> PopulateItemReceiptPreviewText(IDictionary<string, string> previewComments, IPosTransaction posTransaction, ISaleLineItem saleLineItem)

This method gets called every time the product grid refreshes with information.  EPOS will automatically populate the information about discounts, quantity, etc. into the previewComments parameter.  This is a simple dictionary that you can then view and edit before it gets shown on the screen.  For example, if you set a breakpoint at the end of the method, this is what the dictionary looks like for the first line from the screenshot above:


For the first line the Dimension and Discount keys are empty strings, but the Quantity key has the string value "\r\n2 x Youth Accessory Combo Set @ 69.99"

The second item (Adult Helmet Accessory Combo Set) doesn’t have a Quantity key but it has a Discount string value:


The third item… well, the third item doesn’t have any strings stored in the dictionary:


This is because the actual line comment (which is always manually entered) is deemed important enough to always be displayed so it isn’t accessible in previewComments.  It can be manipulated in the saleLineItem but there are better places to do that than in this method.

The values that can be manipulated are these:

        const string itemPreviewTextDiscountField = "Discount";
        const string itemPreviewTextQuantityField = "Quantity";
        const string itemPreviewTextPriceOverriddenField = "PriceOverridden";
        const string itemPreviewTextDimensionField = "Dimension";
        const string itemPreviewTextSalesPersonField = "SalesPerson";
        const string itemPreviewTextSerialIdField = "SerialId";

To stop any of them from being shown on the screen simply set the value of that string to String.Empty:

            previewComments[itemPreviewTextQuantityField] = string.Empty;
            previewComments[itemPreviewTextDiscountField] = string.Empty;

You can also manipulate the existing string (append text, prepend text, search and replace using regex, etc.) or simply replace the string altogether with your own string.  A good example would be use the PartnerData from either the line or transaction itself:

previewComments[itemPreviewTextDiscountField] = "Your discount is " + saleLine.PartnerData.CustomPercentDiscountField.Tostring() + " Percent.";               


A few notes on this new customization opportunity:

  • Make sure to make your code changes outside of the #if DEBUG section in the method.


  • The lines (keys) are always shown in this order:  Product Comment, Quantity, Price Overridden, Dimension, Discount, SalesPerson, SerialID.  It is not possible to change the order that they are displayed but you could be clever in what string is in each key (i.e., there’s nothing stopping you from putting information about discounts into the Quantity key and vice versa).


  • Some of the keys in the dictionary may have multiple lines of information.  For example, there may be more than one discount.  These keys will have a Environment.Newline (\r\n) separating each item.  You may also use this technique in your custom code.


  • This feature introduced a minor display-only bug:  a spurious linefeed will sometimes show on the screen before any of these lines.  You can see this in the first two items on the first screenshot above.  A hotfix has been released for R3 EPOS:  KB 3027988 (6.3.1000.1096).