Applies to version 8.3.x; Author: Kamil Nędza
Humans make mistakes. What is the correct response if someone accidentally creates an erroneous workflow element or duplicates an invoice?
It is possible to delete workflow elements in WEBCON BPS from the form interface in SharePoint. The button to do so is always visible in administrator mode, and can also be made visible normally with the correct configuration option in Designer Studio (screen below).
This article takes a look at what it means exactly to “delete” an element from the system, and how to deal with ‘gaps’ in document numbering left behind by those elements.
The DELETE button on the SharePoint form will remove all data in the database that is associated with the current element.
Whenever we use this feature, we must be aware of the consequences:
- Deleting an element is irreversible. There is no easy way of restoring an element deleted this way.
- If the most recently created element is deleted (i.e. the one with the newest ‘document number’) the next element registered in the system will reuse the deleted element’s number.
- If the deleted element isn’t the most recently added one in the system, a ‘hole’ will be created in the numbering continuity. This is extremely crucial to remember when designing financial processes, where the numbering of elements should be uniform.
- To avoid gaps in the element numbering, block your users from deleting elements, and create an end step in your workflow for “Annulling” unwanted elements (Described below in detail).
What’s going on in the database
Let’s imagine that there are 3 workflow elements created in the system:
Here is some sample data for element KB/2016/04/00002 (element ID 5687):
Now let’s delete this element on the SharePoint form:
The previous query now returns the following results:
We can see that the element, along with a task that was associated with its, is now gone.
Additionally we can see that a new historical entry was created for this element. If a user accidentally deletes an element, the data is not completely lost, however there is no way of restoring the element with its former document number. Info that the element was deleted is stored in the column: WFH_IsVersionOfDeletedElement. In the database, you can also check who deleted the element.
What happens when we create a new element?
The following elements exist in the system:
A new element is registered in the system. As you can see on the screenshot below, it has been given the next possible document number – KB/2016/04/00004 (the number of the deleted document – KB/2016/04/00002 was skipped). No element in the system will ever again be assigned the document number of KB/2016/04/00002.
Good practices: Annulling elements
To avoid gaps in the element numbering continuity, especially in processes where such a continuity is important, we will prevent users from deleting elements altogether. Instead, we will create a ‘Negative end-step’ as a storage bank for discarded workflow elements.
First of all we should take the ability to remove elements away from users – go to the global form template and, and in the ‘Form menu’ tab on the right hand column, uncheck the Display delete button option.
Then create a ‘Negative end-step’ with a very obvious name like “Canceled”. Add paths leading to this end-step from other steps of the workflow, on which you want it to be possible to discard an element:
Additionally, In the “Parameters” tab of the step configuration, it is a good idea to:
- Remove validation – When you discard an element, it usually isn’t necessary to provide data
- Require a comment – So the user may provide a reason for canceling the element
- Change the button style so that it appears bright red – This will make the button’s purpose more obvious and intuitive
With this approach, all workflow elements registered in the system will be accounted for, there will be no gaps in their numbering, and the system administrator will be spared the potential headache of having to deal with elements deleted accidentally by careless users.