Include Additional PSP Parameters (Strategy Designer)

expert level

In case your custom price list logic uses some additional parameters (typically configured for Custom Engines), you can add them as blocks using the additionalParameters option.

The additionalParameters parameter is an object where each key is the PSP’s identifier of the parameter and the value is an object with a label and a type. The label will become the text displayed on the corresponding block in the toolbox and the type will become the return type of that block. Supported types are Number, Boolean, and Text.

Say we have two additional parameters called ‘RRP’ which is a number, and ‘IS_OUT_OF_STOCK’ which is a Boolean value (true or false). This is how you would make them available in the Strategy Designer’s toolbox:

"configuration": {
  "additionalParameters": {
    "RRP": {
      "label": "RRP",
      "type": "Number"
    },
    "IS_OUT_OF_STOCK": {
      "label": "Is out of stock?",
      "type": "Boolean"
    }
  }
}

Each key in the additionalParameters object has to be unique. Make sure there are no syntax errors in the JSON object.

The parameters will be available in the toolbox under the Parameters category:

image-20230627-094716.png

Disclaimer

Writing your own additional parameters is an advanced feature, and there are some rules to follow to avoid breaking the functionality. The parameter’s code may run multiple times and at different times, so the code needs to be idempotent, therefore:

  • DO NOT introduce any side effects, like writing to tables, since these actions are usually not idempotent

  • DO NOT access any of the Strategy Designer’s generated internal variables, such as the cache or any others, as the positions and names of these internal variables may change at any time

An idempotent action is one that produces the same result regardless of how many times it is performed.

Pricefx is not responsible for fixing issues caused by breaking any of the rules above.