Price Grid Custom Mass Action Logic

Since version 9.0

Custom Mass Action logic is used when you need to:

  • Build input fields for the Custom Mass Action dialog.

  • Perform an action (calculation) based on a list of selected LPG products and input values from the user – e.g. partial recalculation of the LPG.

Logic API

  • Logic Nature: parameterizedCalculationFlow

    • Logic Type: Calculation/Pricing

  • Execution Types:

    • Input Generation – Defines the input fields for the Custom Mass Action dialog.

    • Standard – Performs the operations (e.g., starts partical LPG recalculation).

  • Information provided to the logic:

    • In the input generation mode:

      • nothing

    • In the Standard mode:

      • Allow object modifications – true. This logic can modify data in tables.

      • Binding variables:

        • actionBuilder : CalculationFlowActionBuilder

        • input : Map<String,Object> – Values of all inputs provided by the user

        • skus : List<String> – List of product IDs selected by the user

        • triggeredObj : Map<String,Object> – Information about the price grid for which the user executed the Custom Mass Action. Contains PriceGrid (PG) data represented as Map.

        • triggeredObjTypedId : String – typedId of the price grid for which the user executed the Custom Mass Action.

  • Expected logic execution outcome:

    • From input generation mode:

      • Input field definitions

    • From Standard mode execution:

      • Generally any kind of action, commonly it is some action available for the CalculationFlowActionBuilder object.

Configuration

The logic must be referred from the Price Setting Type. Review the article Create a Custom Mass Action to see how to set up the Custom Action Logic for a Price Setting Type.

Code Sample

if (api.isInputGenerationExecution()) { // 1) define input fields for the Custom Mass Action dialog api.inputBuilderFactory() .createIntegerUserEntry("VeryImportantNumber") .getInput() } else { // 2) perform the Custom Mass Action // e.g. recalculate only filtered set of product IDs, selected by the user Map parametersForPGCalculation = input + ["AdditionalParameter" : 123] //❶ actionBuilder.addLivePriceGridAction(triggeredObj."label") .restrictToSkus(skus) .withFormulaParameters(parametersForPGCalculation) //❷ .setCalculate(true) }

❶ Prepare parameters you want to pass to the price grid calculation logic. They will likely contain the values entered by the user in the Custom Mass Action dialog, but generally you can pass any parameters you need.
❷ The method withFormulaParameters() will pass the inputs values to the price grid calculation process, so ultimately those values will be available to the price grid logic, in the same way as any other input fields (e.g. via input binding variable).

Concurrent Executions

To avoid concurrent execution of various custom mass actions or LPG calculations, all tasks related to the same live price grid use the typedId of the LPG as a concurrent key. So if you start multiple custom mass actions (or LPG recalculation) quickly one after another, they will all be scheduled and then performed one by one (and not at the same time).

Performance Considerations

It is recommended that the execution of the process should be reasonably quick, i.e. maximum around 20-30 seconds. If you need a heavy calculation, you can do it later in the LPG logic.

Found an issue in documentation? Write to us.