Class CustomFormApi.WorkflowActionApi

Object
WorkflowActionApi
Enclosing class:
CustomFormApi

public static class CustomFormApi.WorkflowActionApi extends Object
Helper class to work with Workflow statuses. The Workflow custom form status is updated in the database by invoking approve or deny methods.

Note:

- no permissions are checked when the Workflow custom form status is updated,


 api.customFormApi()
     .withId(customForm.id)
     .workflowAction()
     .approve()
 
See Also:
  • Constructor Details

    • WorkflowActionApi

      public WorkflowActionApi(FormulaEngineContext formulaEngineContext, Long id, CustomFormServiceProperties properties, CustomFormService customFormService, PersistedObjectService objectService)
  • Method Details

    • withReason

      public CustomFormApi.WorkflowActionApi withReason(String reason)
      Allow to include a reason / comment for the workflow action. The reason will be added in the comment section of the particular workflow's step. Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .workflowAction()
               .withReason('some reason')
           .approve()
           // added to the workflow if approval succeeded
           api.findWorkflowInfo('CFO', customForm.id).steps[0].comment == 'some reason'
       
      Parameters:
      reason - reason for the workflow action (approve or deny)
      Returns:
      @return a WorkflowActionApi builder instance
    • deny

      public Object deny() throws XExpression
      Finishes the denial 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.

      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .workflowAction()
           .deny()
       
      Returns:
      an Object containing the data of the approved Custom Form or null if failed
      Throws:
      XExpression - if the custom form fails to deny with the specified data
      See Also:
    • approve

      public Object approve() throws XExpression
      Finishes the approval 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.

      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .workflowAction()
           .approve()
       
      Returns:
      an Object containing the data of the approved Custom Form or null if failed
      Throws:
      XExpression - if the custom form fails to approve with the specified data
      See Also: