Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is a sample logic that defines a configurator:

paste-code-macro
languagegroovy
def ce = api.createConfiguratorEntry()

def annualRebate = ce.createParameter(InputType.INTEGERUSERENTRY, "AnnualRebate")
annualRebate.setLabel("Annual Rebate %")
if (annualRebate.getValue() == null) {
  annualRebate.setValue(0)
}

return ce

The quote header logic will look similar to this one:

paste-code-macro
languagegroovy
def configuratorValue = getInputValue("configurator")

def customerId = getInputValue("Customer")

if (quoteProcessor.isPrePhase()) {

  quoteProcessor.addOrUpdateInput("ROOT",
          ["name" : "configurator",
           "label": "Header",
           "type" : "INLINECONFIGURATOR",
           "url"  : "QuoteHeaderConfigurator",
           "value": configuratorValue]
  )
  api.logInfo("quote in prephase1", quoteProcessor.getHelper().getRoot().inputs)
}


return

def getInputValue(inputName) {
  return quoteProcessor.getHelper().getRoot().getInputByName(inputName)?.value
}

Now you must create a header input mass update logic. This logic will generate an input parameter in the Set Parameters step of the Mass Update dialog. If you need to update the input with a static value, simply replace the "r" in the below code with the required value:

paste-code-macro
languagegroovy
def r = api.integerUserEntry("annualRebate")

def c = api.currentItem('inputs').find { it.name == "configurator" }
if (c != null && c.value != null) {
  c.value["AnnualRebate"] = r
}
return c?.value

To be able to see the inner configurator's input on the mass update Summary page, add it to the Modified Inputs table in the following format: configuratorName___inputName (note that there must be three underscores).

...

Info

See also: Configurators and Quote Mass Update.