Sometimes it is required to pass values from a header logic to line items that this logic creates. You can use the HIDDEN input type and reference it in the calculation logic.
The following code sample creates a new quote line with parameters fetched from the header logic:
In the line calculation logic, this value then can be retrieved by:
- This way you can also set default values of "real" input parameters as determined by the line calculation logic. Set the value in the header logic and make sure that the names of the parameter match in both logics.
- If you use this method only to transport values between header & line, set the parameter type to HIDDEN. The value can also be a map to transport more structured data.
- Any parameter that is non-HIDDEN and not determined by the line logic will be removed.
- Be aware that this hidden data is also exposed to the user (it is part of the quote response). It is not visible in the UI, but it is neither a secure storage! Also, try to keep the data volume reasonably low.
You can also set default values for items created using the quoteStructure class: