...
- Use
api.getElement("CustomerGroup").customerFieldValue
, depending on what is in the CustomerGroup element. First define the CustomerGroup element, set the set Display Mode to 'Never':
Code Block title CustomerGroup api.customerGroupEntry()
Then in any other element doing the calculations, use a syntax check.
Also, set the Display Mode of this element to 'Quoting' at at least.Code Block title SomeOtherElement if (api.isSyntaxCheck()) return //as the first line if (api.getElement("CustomerGroup").customerFieldName == "customerId") { return api.getElement("CustomerGroup").customerFieldValue }
...
- Anytime you save a formula, it checks whether the Groovy code is well formed and that the code does some additional mocking of dependencies of the current element (it usually tries to add a neutral element of the type but if it cannot infer the type, it will assume the BigDecimal type).
So in this case, the syntax checker is unable to infer the return type of the expressionapi.getElement("CG")
and will decide to put there a newBigDecimal(1)
. - Usually any logic is run twice. In the first run, it just needs to see all calls to the methods which define input params (and so the
isSyntaxCheck
is set totrue
). 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.
Info |
---|
For more details on |
...