Checking if particular field in Work Item is edited or not?
Hi,
My requirement is to allow a person with particular role say "Project Manager" to edit particular field say "estimate" in work item and If the person saving the workitem has different role then stop it. The approach what I think is, 1.) Getting the old value of the "estimate" field and comparing it with the value after "Save" is performed. Or Putting some Listener for that field (if available) to detect the change. 2.) Check the role of person who has logged in RTC and who is saving the workitem.Compare it with "Project Manager ID" and proceed with rest of the logic. So, There are two things which I want to ask. 1.) One is , How to detect the change in a particular field in workitem. In precondition can it be checked OR I have to use workitem history for getting that? What is the best option for doing it? 2.) How can I know the roles of the person who is saving the workitem? |
Accepted answer
If I understood rightly, the requirement is to control editing of a specific attribute based on the role associated with an user. This is possible directly by using OOTB permissions associated with the specific role.
create a specific role which has permissions to edit attribute assign this role to all users who should have the capability to edit the attribute. additionally, verify that other roles do not allow editing of the attribute for this you may want to look at : Project Area opened in the Eclipse Client > Process Configuration > Team Configuration Permissions > Select a specific Role From Permitted Actions > Work Items > Save Work Item > Modify the work item > Modify the work item's estimate hope it helps Sarthak Sharma selected this answer as the correct answer
Comments
Sarthak Sharma
commented Oct 30 '12, 5:42 a.m.
In addition to it, Suppose if a particular user doesn't have permission to save a particular field and we want this workitem to go for approval(to the approvers defined in the work item) before it is reflected. Is that possible ? |
5 other answers
Hi Sarthak,
The easiest option would probably be to use Preconditions for saving a work item. https://jazz.net/library/article/997/#dynamic walks you through the steps. What you will likely want to do is configure a Precondition of "Read-Only Attributes for Type and State" for every role type except Product Manager. Set the precondition for every state of the work item type. |
You understood it correctly and it is very simple solution.
Thanks Dinesh. |
@Dinesh , One more thing, Suppose if a particular user doesn't have permission to save a particular field and we want this workitem to go for approval(to the approvers defined in the work item) before it is reflected. Is that possible ?
|
can you expand on what it means when you say "before it is reflected?" sorry about my ignorance if its something obvious..
PS: you can reach an user by using @userid, like you tried to and the userid can be known by hovering over the user name and user id appears at the very end of the url... for eg. https://jazz.net/forum/users/din, using this url @<bold part> will take you to the respective user. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.