Class CustomFormApi.WorkflowActionApi
Object
WorkflowActionApi
- Enclosing class:
CustomFormApi
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 Summary
ConstructorDescriptionWorkflowActionApi
(FormulaEngineContext formulaEngineContext, Long customFormId, CustomFormServiceProperties properties, CustomFormService customFormService, PersistedObjectService objectService) -
Method Summary
Modifier and TypeMethodDescriptionapprove()
Finishes the approval operation.deny()
Finishes the denial operation.withReason
(String reason) Allow to include a reason / comment for the workflow action.
-
Constructor Details
-
WorkflowActionApi
public WorkflowActionApi(FormulaEngineContext formulaEngineContext, Long customFormId, CustomFormServiceProperties properties, CustomFormService customFormService, PersistedObjectService objectService)
-
-
Method Details
-
withReason
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:
- a WorkflowActionApi builder instance
-
withUser
To pass aUser
's login name as the WorkFlow logic approver/denier.
NOTE:
- works only forapprove()
anddeny()
,
- if user is not found, the current user from context is used (or null if run in CalculationFlows)
Example:api.customFormApi() .withId(customForm.id) .workflowAction() .withUser('existingUserLoginName') .approve()
-
deny
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
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:
-