Class CustomFormApi.UpdateApi

Object
UpdateApi
Enclosing class:
CustomFormApi

public static class CustomFormApi.UpdateApi extends Object
Helper class to update Custom Forms. The class exposes several methods of the type setXX() for properties of the custom form. The custom form is then updated in the database by invoking the method doUpdate. Note that no permissions are checked when updating the custom form.
See Also:
  • Method Details

    • setLabel

      public CustomFormApi.UpdateApi setLabel(String label)
    • setUserGroupEdit

      public CustomFormApi.UpdateApi setUserGroupEdit(String userGroups)
      Updates the value of userGroupEdit.

      Example:

      
       api.customFormApi()
           .withId(344)
           .updateData()
               .setUserGroupEdit("sales_managers")
           .doUpdate()
       
      Parameters:
      userGroups - the name of an existing user group
      Returns:
      instance of CustomFormApi.UpdateApi
      Since:
      11.1 - Paper Plane
    • setUserGroupViewDetails

      public CustomFormApi.UpdateApi setUserGroupViewDetails(String userGroups)
      Updates the value of UserGroupViewDetails.

      Example:

      
       api.customFormApi()
           .withId(344)
           .updateData()
               .setUserGroupViewDetails("sales_managers")
           .doUpdate()
       
      Parameters:
      userGroups - the name of an existing user group
      Returns:
      instance of CustomFormApi.UpdateApi
      Since:
      11.1 - Paper Plane
    • setInputValue

      public CustomFormApi.UpdateApi setInputValue(String name, Object value)
      Sets the value for an input.
      Parameters:
      name - the name of the input
      value - the value for the input. Can be a simple value, like an Integer or a String, or can be a matrix value, with rows delimited by square brackets.
      Returns:
      the same instance of this class
    • setAttributeExtension

      public CustomFormApi.UpdateApi setAttributeExtension(Map<String,Object> attributeExtension)
      Adds a custom attributeExtension___key:value field to the CustomForm or replaces an existing one – performs a full replacement of the attributeExtension map (does not update specific keys or values). To update a particular value, use the setAttributeExtensionValue(java.lang.String, java.lang.Object) instead.

      setAttributeExtension might be useful for setting the attributeExtension from scratch or for mass actions.

      Information: To view the attributeExtension via UI, add the attribute extension field first – navigate to the CustomForm header context menu (three dots next to the column label) > Customize Attribute Extension. Add the name of the AttributeExtension key you want to display in the table.
      Otherwise, AttributeExtension fields are stored in the database only and are not visible in the user interface. AttributeExtension fields can be fetched with the given CustomForm object.

      Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       api.customFormApi()
           .withId(customForm.id)
           .updateData()
               .setAttributeExtension(["key1": "value1", "key2": "value2"])
           .doUpdate()
       
      Parameters:
      attributeExtension - A map of additional custom attributes of the CustomForm
      Returns:
      The instance of CustomFormApi.CustomFormBuilder
      Since:
      11.1 - Paper Plane
      See Also:
    • setAttributeValue

      public CustomFormApi.UpdateApi setAttributeValue(String attributeName, Object value)
      Updates the value of the specified 'attributeXX' column of the CustomForm class.
      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .updateData()
               .setLabel("New Label")
               .setInputValue("input1000", 1001)
               .setAttributeValue("attribute15","Tofu003")
           .doUpdate()
       
      Parameters:
      attributeName - The name of the attribute to update. For example, attribute15.
      value - The value of that attribute.
      Returns:
      the same instance of this class
    • setAttributeExtensionValue

      public CustomFormApi.UpdateApi setAttributeExtensionValue(String name, Object value)
      Updates the value of an existing attributeExtension___key:value field or creates a new one.

      For mass operations (to add or replace multiple keys and values within the object), use the setAttributeExtension(Map) instead.

      Example:

      
       api.customFormApi()
           .withId(customForm.id)
           .updateData()
               .setLabel("New Label")
               .setAttributeExtensionValue("name", "value")
           .doUpdate()
       
      Parameters:
      name - existing field name
      value - new value
      Returns:
      the same instance of this class
      Throws:
      XExpression - if error occurs or if the field specified by the field name does not exist
      Since:
      11.1 - Paper Plane
      See Also:
    • doUpdate

      public Object doUpdate() throws XExpression
      Finishes the update operation. When this is executed, the Custom Form will be updated in the database.

      Note: Since 12.0.0, this operation only works in contexts that allow object modification. The previous behaviour can still be achieved by using the 'customFormApiAlwaysAllowsObjectModification' application property.

      Returns:
      an Object containing the data of the updated Custom Form
      Throws:
      XExpression - if the custom form fails validation with the specified data The data that can be extracted is:
      • id
      • uniqueName
      • label
      • attributeXX (1..30)
      • inputs (the specific type of the inputs can vary)
      • outputs (the specific type of the outputs can vary)
      See Also: