Applies to version: 2016.1.x; author: Damian Matuła
I want to create a process that would help evaluate how time-consuming the project is. A consultant will create a preliminary evaluation before the instance reaches the person in charge.
The diagram below shows a process created for demonstration purposes. (Fig. 1)
Fig. 1 – Diagram of the main workflow.
And the subworkflow for consultants is as follows (Fig. 2).
Fig. 2 – Diagram of ‘Preliminary evaluation’ subworkflow.
- The Project Manager chooses consultants in the main workflow who will be responsible for making the preliminary evaluation of the project cost.
- There will be an evaluation subworkflow running for every consultant. In this subworkflow, the consultant will need to fill out the form fields necessary for their evaluation (of the time needed to complete the project).
- The main workflow instance will linger in the “Waiting for evaluation” step (this is a special “Wait for sub-workflow step”, its configuration is described later in the article), until the consultant completes their task. A subworkflow must be at least in the “Preliminary evaluation” step for the system to be able to move to the next step.
- Consultants can modify their preliminary evaluation until they haven’t moved it to “Archive” step.
- Based on a consultant’s opinion, the approver makes the final evaluation of the project.
- All subworkflows are finished/canceled by moving them to the final step of the workflow.
Preparation of the demonstration environment.
Workflows were created as seen in Fig. 1&2.
In order to implement the functionality of starting many workflows, we’ll use an item list form field. Let’s call it “Consultants” (Fig. 3).
A workflow with a task for the user from the “Consultant” column will be started for each row of the item list. A “Commentary” column was also added – the user choosing the consultant can write a short memo for him.
Fig. 3 – Item list “Consultants”
Values from this column will be mapped to the form field “Manager’s comment” in the subworkflow.
Fig. 4 – „Manager’s comment” on the subworkflow. The value was copied automatically from the ‘Comment’ column in the parent workflow.
You can find the description of starting subworkflows via SQL queries in the Sub-workflows – practical examples article in section Scenario II – Launching multiple requests for proposals in a marketing campaign.
On the main workflow process, there is a system step “Wait for subworkflows” (Fig. 5) which halts the process until the subworkflow reaches the defined status.
Fig. 5 – Properties section in the general settings of the workflow step.
Fig. 6 – Workflow configuration in the “Wait for subworkflows step. If the PM doesn’t consult the evaluation and there are no subworkflows or all subworkflows have a status of being positively ended (positive end step) the instance will be moved to the next step.
We need to move the instance to the next step as soon as all subworkflows change status to “Positively ended” which is a default move to the final positive step. In our case; we want to change this status earlier, at the time when the consultant first completes their preliminary evaluation. This will allow for a change of decision afterward.
For the above mechanism to work correctly, we’ll use the “Set workflow status” action.
Fig. 7 – Action “Set workflow status”.
The highlighted action changes the subworkflow status for the one specified in the configuration (in this case, a positively ended one (see Fig. 7)). At the same time, it also verifies whether the subworkflows were finished while the parent workflow was in the “wait for subworkflows” step.
Fig. 8 – Action configuration. Apart from available action statuses, there is a possibility to define the status via an SQL query. E.g.: when the status has to change conditionally.
Moving to the acceptance step is allowed only when a consultant completes the preliminary evaluation (Fig. 8).
Fig. 9 – After a preliminary evaluation by a consultant, the parent instance was automatically moved to the “Decision” step.
„Preliminary evaluation” is an intermediate step, with a task assigned to the consultant. It means that he will have the possibility of changing the previously entered value (until he moves the instance to the “Archive” end step) (Fig. 2).