Inputs Behavior in Quote Revisions

Upon a quote revision not only all items are re-calculated but also inputs are re-generated (by running them once in the syntax check mode; the same way as it is done when adding a product).

When inputs with the same name are generated, the values are carried over from the old version. Inputs that do not exist anymore are discarded and new inputs are added. The reason why this is done is that the formula or other things may have changed between the versions. Hence you need to do a full "at the current time" sanity check, otherwise you would carry on with an old format that may be outdated already.

When you have inputs in the header formula, it becomes tricky. As described above, the input generation is on the item level and drops all non-generated inputs as it considers them outdated.

(tick) The conclusion is that ideally the line item logic should create these inputs. Then they will stay.



If you create an input for a line item in the header logic (through quoteProcessor.addOrUpdateInput()) and create a quote revision, the values from the inputs disappear.

This happens only for line items; when added to ROOT, the inputs preserve their values.

Header Logic Snippet
for (lineItemMap in quoteProcessor.getQuoteView().lineItems) {
    if (lineItemMap.folder) continue  //skip folders
            ["name"     : "SampleInput",
             "type"     : InputType.STRINGUSERENTRY,
             "required" : true

The desired behavior somehow conflicts with another standard behavior. 

The solution is to have an input defined at the line items level.

The code snippet here can be fixed just by adding a single formula element to the calculation logic for a line item:


Then the header logic can even stay as is. 

With this change, the input exists in the revision too.