General Workflow Logic
The general workflow logic creates a workflow definition – its steps, conditions, approvers, etc.
To create a new workflow logic:
Go to Administration > Logics > Workflow Logics > General Workflow Logics.
Click the Add Logic button.
In the Workflow Type field, select the type of document for which the workflow will be used.
In the Name field, choose a unique name for the logic.
Enter a Label (optional), Valid After date and the Status (Active or Inactive).
If there are more workflow logics set as Active for a certain document type, then the logic's Valid After date relative to the document's Target Date is the deciding factor. You can choose whether the valid logic is picked based on the document's effective date (and not the submit date). This is set in General Settings in Configuration.Click on the Name of the logic.
Create the workflow logic, i.e., define the condition that will trigger the workflow and assign either approval or watcher step to this condition.
You can also:Assign multiple users / user groups to a single step (using the
.withApprovers
,.withUserGroupApprovers
,.withUserWatchers
or.withUserGroupWatchers
methods).Determine how many distinct users must approve before the step is marked as Approved (using the
.withMinApprovalsNeeded(int)
method; if this method is not used one distinct user is assumed).If the approval is up to individual users, you need to assign this step to as many users as the minimum number of approvals (or more).
If the approval is up to a user group, you can define only one group (the minimum number of approvals can be achieved within one group).
Other notes:
The same user cannot approve the document more than once; only the Workflow Admin can.
Users can perform multiple approvals on a single document only if they belong to multiple user groups – then they can act as an approver once for each group (regardless whether it is an approval or denial). An admin is allowed to do as many steps as defined in the Min Approvals Needed value in the logic.
If the Workflow Admin does the approval, it is not on behalf of a specific user, it is just one of the required approvals (and it does not matter who the other users performing the approval are). The purpose of this functionality is to prevent a workflow from getting stuck if any of the specified users becomes unavailable. It also helps you achieve the functionality of a parallel workflow (without nesting).
Configure denial reasons for users to select from.
Make it mandatory for approvers to add a comment. Use the method
.withMandatoryComments(String... actions)
to define, for which action types a comment will be mandatory. Only "APPROVE" and "DENY" actions are accepted.Run a custom logic after a particular step in a workflow is executed. For details see Workflow Post Step Logic.
Define a quick turnaround of the document if it is rejected by an approver.
Restrict adding extra approver/watcher steps to Workflow Admins only.
Override the element's timeout period (similarly as in calculation logics).
When creating the logic, you will work especially with the
workflow (WorkflowDTO type)
and submitter (User type)
objects; for more details see the API Documentation.Click the Save And Close button.
Examples
This example shows how to add an approval step if TotalPriceValue is more than 1000:
def total = out.TotalPriceValue
def approvers = ["mary","bob"]
if (total != null && total > 1000) {
workflow.addApprovalStep("approval").withApprovers(*approvers).setReason("Total Price went over threshold.");
}
If the ApprovalStep is added with no condition, the workflow is always generated for the given document type.
This example just adds a watcher step. When it is executed, the defined user/group receives an email notification.
workflow
.addWatcherStep("Review").withUserGroupWatchers("Managers").setReason("Status update")
Found an issue in documentation? Write to us.
Pricefx version 13.1