Applies to version 8.0.x; author: Kamil Nedza
When creating workflows, you might end up wanting to have several workflows that operate in a similar way, but differ in certain aspects. If you expect your document to be processed in a similar way, but want the form to be different at some steps, or if you want a step to be omitted, you can easily take advantage of document types. Thanks to them there is no need to create two separate flows. This approach will save your time not only as you create a workflow, but also when you make changes to it later.
Example of the implemented functionality:
You want to execute a workflow of applications for various social benefits (movie tickets, trips, etc.). However, some of them are limited in number (e.g. there is a limited number of seats on the bus or a limited number of available tickets). You want to be able to start the flow in two forms:
- with a limited number of applications: once they run out, the document will automatically close
- with no limit on the number of applicants: the document is passed to the archive only if the person who has created it follows the “Close applications” path.
Figure 1: “Employee applications” workflow diagram
Once the form fields for the process are ready, you create two types of documents. In our case, they are called “Limited list”, “Unlimited list”. Document types are created by expanding a selection tree located to the left by clicking on the “Document types” tree branch and then clicking “New”. Once the document types are ready, for each of them you can globally determine whether they will be available for the workflow that starts within a given document type. You can determine their visibility by selecting “Field visibility” in the right panel. All form fields are visible by default. In our case, the “Number of spaces” attribute for the “Unlimited list” document type is unchecked since the number of benefits under this flow is not limited.
Figure 2: Hiding the “Number of spaces” attribute for the “Unlimited list” document type
In the above example there are not many form fields, but in production deployments there can be plenty of them and it is easy to get lost. That is why you can always look at the table of form fields and preview which attributes are visible and how they have been set for each document type.
Now you go to the configuration of the “Employee applications” step. The figure below presents a configuration of one of the two paths of “Employee applications”. The visibility of the path has been set in such a way that only the person who had registered the document was able to close it.
Figure 4. Hiding the visibility of the “Close applications” path for people who did not create the document
Then add the action which takes you to the next step, on entrance to the “Employee applications” step. At that point, if “Unlimited list” is the document type, the action is not performed. Otherwise, the number of entries on the “People list” item list is checked. If I equals the number of available spaces, the document will automatically follow the “Complete applications” path.
Figure 5. Condition for the execution of SQL for the “Limit reached” action
Figure 6. Condition for the execution of SQL for the “Limit reached” action
Verification of the functionality
First, we register an “Unlimited list” document type. We set an example limit on the value equal to 3.
Figure 7. Registration of a workflow for an “Unlimited list” document type
Employees can then add entries to the “People list” item list. Once the third person has followed the “Apply” path, the document will automatically close.
Figure 8. The third person registers with the list
After the path has been followed, the document will automatically move to the “Completed” step.
Then we register the “Unlimited list” document type. In contrast to the previous document type, we can see that “Number of spaces” is not displayed.
Figure 10. Registering the document for the “Unlimited list” type
The document behaves differently in the “Employee applications” step now. There is no limit of entries to the “People list” item list. The document will never automatically move to the “Completed” step. To make it get there, the person who has registered the document must go through the “Close applications” path.
Figure 11. View of the form in the “Employee applications” step for the “Unlimited list” document type as seen by the data inputter.