This example shows how to enhance the input on the header level, for example set up a default value. When you need to copy this value to the line items, you have to iterate through the list of line items and call the addOrUpdateInput
function where you can specify the input attributes.
// create the input with Quote Types String[] UoMs = ["kg", "lb"] quoteProcessor.addOrUpdateInput( "ROOT", ["name": "baseUoM", "label": "UoM", "type" : InputType.OPTION, "valueOptions" : UoMs, "required" : true, "value": getInputValue("baseUoM")?:getDefaultUoM() ] ) def baseUoM = quoteProcessor.getHelper().getRoot().getInputByName("baseUoM")?.value /* distribute the UoM to the line items */ for (lineItemMap in quoteProcessor.getQuoteView().lineItems) { if (lineItemMap.folder) continue //skip folders quoteProcessor.addOrUpdateInput(lineItemMap.lineId, ["name": "UoM", "label": "UoM", "type" : InputType.OPTION, "valueOptions" : UoMs, "required" : true, "readOnly" : true, "value": baseUoM ] ) } def getDefaultUoM() { customer = getInputValue("Customer") if(customer != null) { cust = api.find("C", Filter.equal("customerId",customer)) if(cust != null) { country = cust[0].attribute6 if(country != null) { uom = api.findLookupTableValues("CountryDetails", Filter.equal("name", country)) if(uom != null) { return uom[0].attribute3 } } else { return "kg" } } else { return "kg" } }else { return "kg" } } def getInputValue(inputName) { return quoteProcessor.getHelper().getRoot().getInputByName(inputName)?.value }