This article describes how to poll for next task using a script with waiting variables, to improve the user feedback when a user task and other tasks are done in parallell.
The polling behavior is applicable when the asynchronous tasks are expected to take some time, perhaps a minute or so, so that it makes sense for the user to wait for it to finish.
Issue without polling: User task shows up in Open tasks, without feedback
When a user task and some other service tasks are in progress at the same time and if one path of the parallel gateway is not finished when the user clicks Next, then the following issues occur:
- The following tasks after the 'closing gateway' are not started until all tasks in both paths are finished, and the user gets no feedback to show that.
- Any following user task after the 'closing gateway' is not displayed directly, but shows up in Open tasks.
For example, this is relevant when a user task is active at the same time as card production is running in the Personal Desktop App.
Here is a simple example process:
Behavior without polling
Without polling for next tasks, then two things can happen when a user clicks on Next after completing User Task 1:
- The timer event is already finished: In this case the user gets User Task 2 displayed.
- The timer event is not finished: The user gets the process end message and User Task 2 will be in Open Tasks after the timer event is finished.
In case of card production in Personal Desktop App, then User Task 1 would be the plugout URL and the timer event would be a message event and some other tasks.
Solution: Use script to poll for next tasks
To solve the issue, a script can be used to poll for next tasks, according to the defined variable values.
- In PRIME Designer, open the related process for editing.
- Before the parallell paths with user task and other tasks, add a script task. In Attributes, select the script
Click the pen symbol, to edit the script task. Set values to the following variables:
The variables are described in the following table:
|META_WAIT_FOR_TASK_COUNT||30||Defines how many times it should poll.|
|1000||Defines how many milliseconds it waits between the polling. The value |
30, the mechanism checks if there is a next task once every second and closes the user task after 30 seconds.
Behavior with polling
For user tasks which are not followed by any asynchronous tasks, the mechanism does nothing and the process finishes normally.
If there is something asynchronous after the user task and the variables are set, the user has to wait until one of the following happens:
- There is a user task
- The process ends
- The timeout is reached
With the above variables configured, the following things can happen after clicking Next in User Task 1:
- The timer event is finished:
In this case the user gets User Task 2 displayed. The
META_WAITvariables are not touched.
- The timer event is not finished:
META_WAITvariables are checked and reset in the process map. Until the parallell tasks are finished or the polling ends, the User Task 1 dialog is still displayed with a progress bar.
- If the timer event is finished before the polling ends, then the user gets User Task 2 displayed.
- If the polling ends before the event is finished, then the user gets the process end message and User Task 2 will be in Open Tasks after the timer event is finished.
Predefined processes in Smart ID Digital ID
The polling script task and the timer variables are predefined in the following processes in Smart ID Digital ID:
- No labels