Hi Everyone,
I am handling the task assignment through database tables. But when two users will click simultaneouly on the link which will start the process model. How to ensure that only one user should be given the task.
Discussion posts and replies are publicly visible
Hi Rahul009 ,I have a solution for this, please follow below steps :
User clicks the link
Start a process model
Checks if the task is already assigned :
If Yes → show user “Task already assigned” or end process.
assigned_to
.
Check if the assignment succeeded.
Move forward and assign the task.
Note :
Make sure the assigned_to column is NULL by default.
NULL
Consider placing a unique constraint on task_id + assigned_to if you want stricter DB rules.
task_id
Hope this helps you!!!
Hi Varun Teja Gurrapu ,
thank you for your response, but if two users click on task at the same time so they will be presented the same user input form. How to avoid this?
If you build the process right, there's no way this can happen. I built one of these myself once and I tested with another person where we both sat and tried to click at exactly the same time, but still one of us got into the task and the other one was locked out due to the process locking. The process flow executes so quickly that milliseconds of difference is enough.
Hi Mike Schmitt ,
Can you please help me how to apply process locking to avoid such instances?
There's no bre-built process locking to "apply", maybe i chose a misleading term. What I meant is that you should build your process to handle the locking for you.
In the process after any user attempts to click into the "task" in question, the very first thing that should happen is for the process to query the relevant DB table to check whether another user has already accessed the "task", and if so, divert the process flow to an alternate task explaining that this task is in use by another user. If not, the very next thing it should do is write the locking value immediately back to that same table, before proceeding on to the user input task or any other pre-task processing.