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
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. |