Locking a workitem programitacally using plugin.
We have created a plugin which has scheduler to update work item at a regular interval of time. These intervals are defined in process configuration source. Scheduler updates few attributes using one admin account defined.
The problem is when normal user is updating a work item at the same time if admin updates the work item then user have to refresh the WI and loose his changes. Is it possible to lock WI by admin before to it does the updates.
This should lock WI editor for all other users before performing updates.
Regards,
Rhishi
One answer
Comments
Consider to run your automation during the night when the user activity is light.
You may be able to do a server-side Validator which could tell if it is during this "locked" timeframe and give an error, but as you noted in your original question, this doesn't lock the WI editor, only doesn't allow the save to go through after the user has made all of his/her changes in the editor.
You may be able to add a text attribute at the top of the work item and do a calculated field which would tell the user if the work item is "locked" or not (without actually locking it). But this is about the best I can think of.
Thanks Ralph for the info. Actually the scheduler is stopped during night. But it needs to update attributes during business hours and the update of attributes is triggered by save operation either by Admin account(which performs update at defined interval) or by user doing some fields update. So there is no locking mechanism that can be possible using programing in plugin.
@Hanson Thanks for your reply. Will check on implementation of such locking indicator however i am afraid that still will cause trouble for the users.
I wonder what the updates actually are. If possible I would
- implement them in a follow up action on saving the work item
-
Or implement them using value provides (e.g. caluculated values).