How to pass results calculated in the quote header logic to the line items?
Question
Sometimes you need to evaluate the whole Quote and then pass that result to the line items.
Some of the use cases:
You need to evaluate the "type" of the Quote – if the products are from the same category or from mixed categories. Depending on that you will make different calculations for the line items.
You want to evaluate the mix of the line items and in certain cases add a new line (via the header logic) to the list of products on the Quote. But you want to avoid the situation that this addition will happen again the next time you press "Calculate Quote". So you need to set some "flag" on the line item which causes the new line being added.
In both these examples we need to pass some information from the header logic to the line item.
Answer
The only way to pass information from the header logic to the line item is via the "hidden" input for the line item.
But you must take in account that you cannot do this in the pre-phase. This will work only in the post-phase.
This is not acceptable in some cases; for example, if a new product line has just been added to the Quote (either manually by the user or by a pre-phase header logic).
In some scenarios there is a useful workaround: you can store any information into a "hidden" input of the ROOT folder (even a map, not only numbers and strings). So you can, for example, in the pre-phase store a map where Key=LineId and Value=your_value and then in the post-phase you can read it from there and pass it to the hidden input of the line.
Found an issue in documentation? Write to us.