Enabling extensibility on Pricing

Disclaimer: This is only a proposed solution and is subject to change without further notice


Here is an overview of the changes being done to make the pricing area extensible. Pricing is a heavily customized area and modifying the price search is currently impossible without overlayering. This article outlines a proposed solution for some of the most commonly seen customization scenarios in the pricing area.

You would be interested to read this if you currently have any customizations around the price and discount search in Dynamics 365.

The solution described is targeted the upcoming Dynamics 365 Fall Release 2017. The intent of this article is to get some early feedback on how it fits the different customizations in the pricing area. if there are any other customizations you have around the pricing area that will not be addressed in this proposed solution, please leave a comment below or request additional extension points.

Proposed solution

Some of the most commonly seen customizations in the pricing area are:

  1. Adding new price group types and the corresponding price types (enum values for PriceType and PriceGroupType) and adding search mechanisms for the new price types.
  2. Modifying the price and discount search, including passing in any additional parameters to the PriceDisc class.

 The proposed solution here is targeting to address the above main scenarios.

 PriceType and PriceGroupType enums

 Typically, adding a new type of price discount search would start with adding a new enum value in the two enums - PriceGroupType and PriceType. To enable these for extensibility, the behavior around the PriceGroupType and PriceType enum values are now encapsulated in the class hierarchies PriceGroupTypeTradeAgreementMapping and PriceTypeTradeAgreementMapping respectively. These should be extended for any new PriceGroupType and PriceType extended enum values.

PriceTypeTradeAgreementMapping would also be where the mapping of fields on the Customer/Vendor tables or InventTable table corresponding to the price types, is defined.

NOTE: In the diagram below, the methods are only shown on one of the sub-classes (only for illustration), though the implementation needs to be on each.



PriceDisc class

The PriceDisc class is the search engine for price and discounts. This class will now use a PriceDiscParameters object as a member for passing in the parameters, used in the price and discount search. This should enable passing in the additional search parameters for the specific solutions.

Only the parameters specific for a given PriceGroupType search are passed through the corresponding find methods on the PriceDisc class.

The possibility to wrap and modify the instantiation of the PriceDiscParameters class will be enabled for all price and discount search calls made throughout AppSuite.

Below you can see how the PriceDisc class can be extended to modify existing searches or to add a new search method corresponding to the new extended PriceType enum values.


Walkthrough: Add a new price search


Let's say we have extended the PriceGroupType enum with a new value PriceGroupTypeISVExtension, and two corresponding PriceType enum values - ISVPurchPriceType and ISVSalesPriceType.


The below illustrates how a new price search can be added for the above PriceGroupType and PriceType extended enum


In this example:


  1. For the newly created PriceGroupType value, a PriceGroupTypeTradeAgreementMappingISVPriceGroupType class decorated with the attribute ISVPriceGroupType should define the behavior of the price group type.
  2. For the newly created PriceType value, the PriceTypeTradeAgreementMappingISVPurchPriceType and PriceTypeTradeAgreementMappingISVSalesPriceType classes corresponding to Purchase and Sales would be implemented.
  3. The PriceDiscParameters class should be augmented to add any generic parameters for the price discount search.
  4. The PriceDisc class should be augmented to create the new price discount search methods for the new price types.


The PriceDiscParameters is accessible in several of the classes related to price and discount search and these could be augmented, based on the requirements.



Comments (3)

  1. Ripsnan says:

    Hi Michael,
    Nice post. It would be great if you can provide a solution to calculate the line amount of sales and purchase order lines based upon some added fields using extension. Intended calculation is ((unit Price * quantity) + (newly added field price * quantity)) = Line amount.

    1. Ripsnan, line amount calculation can be modified through the methods on the SalesPurchLinePriceDiscCalculation class. You would need to extend the class SalesPurchLinePriceDiscCalculation and implement the methods on the sub-class with your calculations. Also look into the lineAmount* methods on the SalesPurchLineInterface, depending on if you would like more granular control of the calculations.

      Let us know if you need more details.

  2. Great changes! What would also really help is changing PriceDiscAdmCheckPost class to use the strategy template. PriceDiscAdm journals are also often customized in AX.

Skip to main content