It's all about the answers!

Ask a question

Locking a workitem programitacally using plugin.

Rhishikesh Patil (1311125) | asked Sep 23 '14, 3:55 a.m.
edited Sep 23 '14, 4:05 a.m.

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.


One answer

permanent link
Ralph Schoon (55.8k23642) | answered Sep 23 '14, 4:17 a.m.
There is, as far as I know, no locking mechanism for Work Items. There is none in the UI that I am aware of and none in the API. The user will not recognize a work item is changed while he is doing changes and will have to refresh if that is the case, like if some other user did a change.

Ralph Schoon commented Sep 23 '14, 4:31 a.m.

Consider to run your automation during the night when the user activity is light.

Susan Hanson commented Sep 23 '14, 8:29 a.m.

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.

Rhishikesh Patil commented Sep 24 '14, 4:05 a.m.

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.

Ralph Schoon commented Sep 24 '14, 4:26 a.m.

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).
In that case collisions would be less likely.

Your answer

Register or to post your answer.