This section guides you through user substitution and how to work with it in the WSO2 Business Process Server.
User substitution involves defining a substitute for a particular user for a given time window. This is particularly useful in BPMN user tasks when the original task assignee becomes unavailable, for instance, goes on vacation. In this case, all the tasks assigned to this user will get delayed until the particular assignee is available again and nobody else will be able to work on these tasks either. To avoid this kind of unnecessary processing delay, you can use the user substitution feature. This means that when a user is not available for a certain period of time, all tasks assigned to that user will be assigned to the defined substitute instead.
How it works
Users are allowed to define a substitute for themselves within the time period that they are going to be unavailable. Once this specified period (substitution period) starts, all the existing tasks of the user are transferred to the substitute (i.e.,bulk reassignment). From this point onwards, any tasks that are going to be assigned to the user will be assigned to the substitute user instead. To the existing tasks for which the particular assignee is a candidate user, the substitute user will also be added as a candidate user.
If the given substitute is also not available (i.e., the substitute also goes on vacation), you can enable transitivity. Enabling transitivity allows the engine to try and find a transitive substitute by going through available substitution records. In this way, the engine uses the best available user as the substitute. However, if the system could not find a proper substitute (i.e., there is a cyclic dependency between substitutions), it will return an error, rejecting the substitution request. This rejection is possible only for the substitutions that start just after the substitute request. For a scheduled substitution, if the engine ends up without a proper substitute, the tasks of the user will be assigned to the ‘task owner’. If the task owner is not defined, the assignee will be removed from the tasks and it will be claimable.
The WSO2 Business Process Server provides REST APIs to add, update and lookup substitution information. Alternatively, you can also use the BPMN-explorer to experience all the facilities provided by substitution APIs.
Enabling user substitution
Run the database script <BPS_HOME>/dbscripts/bps/bpmn/create/activiti.<DB_Name>.create.substitute.sql against your bpmn engine's databse to add the Substitution related table.
activiti.xml file found in the
<BPS_HOME>/repository/conf/ directory and uncomment the following configuration.
|enabled||true||Set to true to enable the substitution feature.|
|enableTransitivity||true||Set to true to enable substitution to transitive substitutes if the provided substitute is not available, as explained above.|
|activationInterval||<scheduler running interval in minutes>||A scheduler is running to activate scheduled substitutions and update transitive substitutes if transitivity is enabled. Specify the time interval in minutes that the scheduler should run. The scheduler activates a given substitution in the time frame specified here.|
Each valid user has permission to add update and view his/her own substitution records and to view the substitution records where he/she acts as a substitute. Viewing and changing substitution records of other users requires the 'substitution' permission. The substitution permission path is as follows.
See Managing Role Permissions for more information on adding permissions.
Adding and managing user substitution
This section guides you through adding, updating and viewing substitutions. You can do this using either the BPMN-explorer user interface or using the substitution APIs.