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 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 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:
      true if 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:
      true if the current context is the "post" phase, i.e. after line items have been calculated
    • addOrUpdateInput

      CustomFormCollectionBuilder addOrUpdateInput(Map<String,Object> contextParameter)
      Adds or updates an input parameter on the ROOT level. Use the InputBuilder methods 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

      CustomFormCollectionBuilder addOrUpdateInput(String lineId, Map<String,Object> contextParameter)
      Adds or updates an input parameter on a folder (f.e. "ROOT") with the given lineId. Use the InputBuilder methods 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

      CustomFormCollectionBuilder addOrUpdateOutput(Map<String,Object> calculationResult)
      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

      CustomFormCollectionBuilder addOrUpdateOutput(String lineId, Map<String,Object> calculationResult)
      Adds or updates a result value (an output value) on a folder (f.e "ROOT") with the given lineId.

      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

      CustomFormCollectionBuilder updateField(String fieldName, Object value)
      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

      CustomFormCollectionBuilder updateField(String lineId, String fieldName, Object value)
      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

      CustomFormCollectionBuilder setRenderInfo(String fieldName, String key, Object value)
      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, deleteButton and revisionButton. They accept the boolean key hide.

      Example:

      
       customFormProcessor.setRenderInfo("revisionButton", "hide", false) // displays the "Create New Revision" button
       
      Note: Once you hide a button, you have to explicitly set hide to false or use clearRenderInfo(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

      CustomFormCollectionBuilder clearRenderInfo(String fieldName)
      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, or null to clear all info for all fields.
      Returns:
      itself (for the fluent pattern)