How to Show customerId Value from customerGroupEntry Picker in Outputs

Let's assume you want to show the customerId value in the outputs. 

If you used just api.customerGroupEntry(), then the result in UI would be shown as e.g., "CG['customerId' = '60838']".

The correct procedure to display the value '60838' is:

  • Use api.getElement("CustomerGroup").customerFieldValue, depending on what is in the CustomerGroup element.
  • First define the CustomerGroup element, set Display Mode to Never:

    CustomerGroup
    api.customerGroupEntry()
  • Then in any other element doing the calculations, use the input generation mode.
    Also, set Display Mode of this element to Quoting at least.

    SomeOtherElement
    if (api.isInputGenerationExecution()) return //As the first line. isInputGenerationExecution supported from version 10.0, in older versions use isSyntaxCheck
    if (api.getElement("CustomerGroup").customerFieldName == "customerId") {
      return api.getElement("CustomerGroup").customerFieldValue
    }

About Input Generation Mode

Usually, every logic is run twice. In the first run, it just needs to see all calls to the methods which define input params (and so isInputGenerationExecution is set to true). Otherwise it is a normal logic run and this variable is set to false. The first run is really needed for the system to know what inputs the logic will generate.

For more details on isInputGenerationExecution (formerly isSyntaxCheck), see Miscellaneous Functions.

Found an issue in documentation? Write to us.