Class CustomFormApi

Object
CustomFormApi

public class CustomFormApi extends Object
Utility class to work with Custom Forms in Groovy code
  • Constructor Details

    • CustomFormApi

      public CustomFormApi(FormulaEngineContext formulaEngineContext, ObjectMapper objectMapper)
  • Method Details

    • fetchCurrentItemEmbeddedCustomForms

      public List<CustomForm> fetchCurrentItemEmbeddedCustomForms()
      Fetch CustomForms which are created with the embedded CustomFormType.
      Example:
      
       // Header logic of parent type:
       if (api.isInputGenerationExecution()) return null
       quoteProcessor.addOrUpdateOutput('ROOT', [
              resultName: 'CurrentItemEmbeddedCustomForms',
              isOverridable: true,
              result: api.customFormApi().fetchCurrentItemEmbeddedCustomForms()
           ])
      
       // If parent type is created with the JSON configuration creating CFOs based on the embedded CustomFormType
       // the parent object output will be updated with all CFO children in the result.
       
      Returns:
      Collection of CustomForms child
      Since:
      14.1 - Caribou Lou
      See Also:
    • fetchCurrentItemParent

      @Nullable public Object fetchCurrentItemParent()
      Fetch parent object from the child CustomForm's object level (if built with the embedded CustomFormType).
      Example:
      
       return api.customFormApi().fetchCurrentItemParent()
       
      Returns:
      Parent object, ex. standalone CustomForm
      Since:
      14.1 - Caribou Lou
      See Also:
    • newCustomForm

      public CustomFormApi.CustomFormBuilder newCustomForm()
      Initiates a builder object to create a new Custom Form. The operation is finished with the create method.

      Example:

      
       def customForm = api.customFormApi()
           .newCustomForm()
               .setName("CustomForm01)
               .setLabel("my custom form 1")
               .setTypeId(1)
               .setAttributeValue("attribute1", "meatball01")
               .setAttributeExtensionValue("name", "value")
               .setUserGroupViewDetails("viewGroup")
               .setUserGroupEdit("groupEdit")
           .create()
       
      Returns:
      this builder instance
    • withId

      public CustomFormApi.OperationsApi withId(Long id)
      Initiates an operation with an existing Custom Form by id. Please note that this is a numeric, database id, not a typedId. This is because this API is exclusively for Custom Forms only, so no other objects can be used, and no distinction on the type is then necessary.
      Parameters:
      id - The database id of an already existing Custom Form
      Returns:
      an Operations' builder instance
      See Also: