Interface CustomFormApi
Get it with api.customFormApi(). It creates new Custom Forms (newCustomForm()) and works with an
existing Custom Form by its ID (withId(Long)): it updates, duplicates, recalculates or deletes it, creates
a revision, submits, withdraws or revokes it, and approves or denies its workflow step.
In the logic of a Custom Form built with an embedded Custom Form Type, it fetches the parent object
(fetchCurrentItemParent()). In the logic of the parent object, it fetches the embedded Custom Forms
(fetchCurrentItemEmbeddedCustomForms()).
The operations do not check the user's permissions to the Custom Form. CustomFormApi.WorkflowActionApi.approve() and
CustomFormApi.WorkflowActionApi.deny() still require that the user (the current user, or the one set with
withUser()) can approve the current workflow step.
The operations that change a Custom Form work only in contexts that allow object modification, and not in the
"input generation" mode. The exception is CustomFormApi.RecalculateApi.doRecalculate(): since 12.2.0, it saves the
Custom Form also when object modification is not allowed.
Example: creates a Custom Form and submits it:
if (api.isInputGenerationExecution()) return
def customForm = api.customFormApi()
.newCustomForm()
.setTypeId(123)
.setLabel("My Custom Form")
.create()
api.customFormApi()
.withId(customForm.id)
.documentAction()
.submit()
- Since:
- 9.0 - Hurricane
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHelper class to create Custom Forms.static interfaceHelper class to work with Custom Forms statuses.static interfaceHelper class for all operations on Custom Forms.
Example:static interfaceHelper class to recalculate Custom Forms.static interfaceHelper class to update Custom Forms.static interfaceHelper class to work with Workflow statuses. -
Method Summary
Modifier and TypeMethodDescriptionList<?> Fetch CustomForms which are created with the embedded CustomFormType.
Example:Fetch parent object from the child CustomForm's object level (if built with the embedded CustomFormType).
Example:Initiates a builder object to create a new Custom Form.Initiates an operation with an existing Custom Form by id.
-
Method Details
-
fetchCurrentItemEmbeddedCustomForms
List<?> 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
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
CustomFormApi.CustomFormBuilder newCustomForm()Initiates a builder object to create a new Custom Form. The operation is finished with thecreatemethod.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:
- a new Custom Form builder instance
- Since:
- 9.0 - Hurricane
- See Also:
-
withId
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.Example:
api.customFormApi() .withId(344) .updateData() .setLabel("New Label") .doUpdate()- Parameters:
id- The database id of an already existing Custom Form- Returns:
- an Operations' builder instance
- Since:
- 9.0 - Hurricane
- See Also:
-