Interface CustomFormCollectionBuilder
public interface CustomFormCollectionBuilder
CustomFormCollectionBuilder is the starting point for manipulating a custom form object
in a custom form header calculation logic.
The header calculation is executed twice: Once as 'pre phase' and once after that as 'post phase'.
Use
The custom form builder is available in the header logic by this call:
IMPORTANT: Please read super class notes on the sequence of execution!
The header calculation is executed twice: Once as 'pre phase' and once after that as 'post phase'.
Use
isPrePhase() and isPostPhase() methods to detect the current phase. The custom form builder is available in the header logic by this call:
def processor = customFormProcessor
IMPORTANT: Please read super class notes on the sequence of execution!
-
Method Summary
Modifier and TypeMethodDescriptionaddOrUpdateInput(String lineId, Map<String, Object> contextParameter) Adds or updates an input parameter on a folder (f.e.addOrUpdateInput(Map<String, Object> contextParameter) Adds or updates an input parameter on the ROOT level.addOrUpdateOutput(String lineId, Map<String, Object> calculationResult) Adds or updates a result value (an output value) on a folder (f.e "ROOT") with the givenlineId.addOrUpdateOutput(Map<String, Object> calculationResult) Adds or updates a result value (an output value) on the ROOT level.clearRenderInfo(String fieldName) Clears the existing render info for a field, or for all fields.Gets a helper class that assists in manipulating the custom formbooleanDetermines the current calculation phase of the header logic execution.booleanDetermines the current calculation phase of the header logic execution.setRenderInfo(String fieldName, String key, Object value) Sets (adds or updates) rendering information for a particular header field or button.updateField(String fieldName, Object value) Updates a header field value.updateField(String lineId, String fieldName, Object value) Updates a field on the line (f.e.
-
Method Details
-
getHelper
LineItemHelper getHelper()Gets a helper class that assists in manipulating the custom form- Returns:
- The helper object
-
isPrePhase
boolean isPrePhase()Determines the current calculation phase of the header logic execution.- Returns:
trueif the current context is the "pre" phase, i.e. before line items are calculated
-
isPostPhase
boolean isPostPhase()Determines the current calculation phase of the header logic execution.- Returns:
trueif the current context is the "post" phase, i.e. after line items have been calculated
-
addOrUpdateInput
Adds or updates an input parameter on the ROOT level. Use theInputBuildermethods to define properties of the input.Example:
if (customFormProcessor.isPrePhase()) { def userInputMap = api.inputBuilderFactory() .createUserEntry("Discount") .setRequired(true) .buildMap() customFormProcessor.addOrUpdateInput(userInputMap) }- Parameters:
contextParameter- A map describing the context parameter (user input).- Returns:
- itself (for the fluent pattern)
- See Also:
-
addOrUpdateInput
Adds or updates an input parameter on a folder (f.e. "ROOT") with the givenlineId. Use theInputBuildermethods to define properties of the input.Example:
if (customFormProcessor.isPrePhase()) { def userInputMap = api.inputBuilderFactory() .createUserEntry("Discount") .buildMap() customFormProcessor.addOrUpdateInput("ROOT", userInputMap) }- Parameters:
lineId- The id of the folder.contextParameter- A map describing the context parameter (user input).- Returns:
- itself (for the fluent pattern)
- See Also:
-
addOrUpdateOutput
Adds or updates a result value (an output value) on the ROOT level.For a map example and further details, see
addOrUpdateOutput(String, Map).- Parameters:
calculationResult- A map describing a calculation result.- Returns:
- itself (for the fluent pattern)
-
addOrUpdateOutput
Adds or updates a result value (an output value) on a folder (f.e "ROOT") with the givenlineId.Example:
customFormProcessor.addOrUpdateOutput("ROOT", [ "resultName" : "Message", "resultLabel": "Message", "resultType" : "TEXT", "result" : "Hello" ] )- Parameters:
lineId- The id of the folder.calculationResult- A map describing a calculation result.- Returns:
- itself (for the fluent pattern)
- See Also:
-
updateField
Updates a header field value.Example:
customFormProcessor.updateField("attributeExtension___Description", description)- Parameters:
fieldName- The field name.value- The new value.- Returns:
- itself (for the fluent pattern)
-
updateField
Updates a field on the line (f.e. "ROOT")- Parameters:
lineId- The id of the line.fieldName- The field name.value- The new value.- Returns:
- itself (for the fluent pattern)
-
setRenderInfo
Sets (adds or updates) rendering information for a particular header field or button. The available key/value pairs depend on the particular field; if a key that is unknown to the client is used, it is ignored.For Custom Forms the following buttons are supported:
submitButton,recalculateButton,withdrawButton,revokeButton,editButton,duplicateButton,deleteButtonandrevisionButton. They accept the boolean keyhide.Example:
Note: Once you hide a button, you have to explicitly setcustomFormProcessor.setRenderInfo("revisionButton", "hide", false) // displays the "Create New Revision" buttonhidetofalseor useclearRenderInfo(String)in order to let the button re-appear.- Parameters:
fieldName- The name of the field or button this setting should be applied on.key- The setting name (e.g.hide).value- The value, an attribute of boolean type.- Returns:
- itself (for the fluent pattern)
-
clearRenderInfo
Clears the existing render info for a field, or for all fields.Example:
customFormProcessor.clearRenderInfo("submitButton")- Parameters:
fieldName- The field name to clear all info for, ornullto clear all info for all fields.- Returns:
- itself (for the fluent pattern)
-