Add and Modify Columns in Price List/Grid

Adding and modifying existing PL / LPG columns is one of more common customizations that can be applied to Price Setting Accelerator. This is why most elements in user-facing PL / LPG logics act as “dispatchers” for more complex operations. It makes it easier to add custom behavior or modify one step of the calculation without affecting other parts of the underlying logic. You can find more information about this approach in Upgrade of Customized Accelerator (Price Setting).

Currently the recommended way to modify available columns is by the standard Groovy modifications. You can also use logic inheritance but this feature is not supported by Pricefx Studio.

Prerequisites

This article assumes that:

  • Price Setting Accelerator is deployed to the partition and you have a working Live Price Grid configured with PSP_PricingLogic where you can test your changes. Check Install Price Setting Accelerator for more info.

  • You are a Configuration Engineer or have sufficient knowledge of Groovy coding, Pricefx Studio and managing and linking libraries of code to undertake the technical configuration.

Configuration Overview

The user facing logic is called PSP_PricingLogic. Its features, along with other utils, are defined mostly in the PriceBuilderCommonElementUtils Groovy library.

Let’s take a look at a simple CompetitionData element and try to understand what we will be working with:

Groovy
/**
 * Inputs: ❶
 * - RawCompetitionData
 * Outputs
 * - Matrix of competition data
 * Details: ❷
 * - This element is conditional, Competitions module needs to be turned on
 * - This is one of "End points" of our logic, return is displayed to user
 * - All competition data is displayed. For relevant competition data, see RelevantCompetitionData element
 */
return out.WarningManager.tryToExecuteElement("CompetitionData") { ❸
    Map productCompetitionConfigManager = out.ProductCompetitionConfigManager
    def competitionData = out.RawCompetitionData

    return libs.PriceBuilderCommonElementUtils.Library.buildCompetitionDataResultMatrix(productCompetitionConfigManager, competitionData) ❹
}

❶ Most non-utility elements have a comment that explains what the required inputs are (other elements or configurations) that are used by a given element. They will also explain what the structure of outputs is.
❷ Details will contain additional information that may be useful for understanding what is going on in this element.
❸ To support modularization and proper warning handling, all elements will go through this pass-through tryToExecuteElement method. What is important for you is that the body of this method is executed as if it was a normal element code. For more info check out Error Handling Deep Dive.
❹ Some calculations and business logic will be delegated into a library method.

All elements that produce PL / LPG columns visible for users will have this structure, so usually this is what you will be looking for during analysis of your requirements.

Further reading: