This is part of a larger restriction, but the part that is tripping me up is being able to allow only the user that created a work item (the value of the "System.CreatedBy" field) to transition a work item to the Closed state. I am aware of how to restrict the transition using the "For" and "Not" clauses, but those are limited to groups. I want to restrict it to the specific creator of THIS work item. VALIDUSERS is also limited to groups (either TFS or AD). Thanks for your help.
I was able to find a suitable solution last night.
This solution actually works perfectly for my need as it allows me to add a group as exempt from the rule so that members of the group, say QA, as well as the Creator are able to close the work item, while other members of the team are not.
Reference: here (web archive link)
As referenced:
<FIELD name="Closed By Validation" refname="Demo.ClosedByValidation" type="String">
<COPY from="currentuser" />
<FROZEN not="[project]\Project Administrators"/>
</FIELD>
<STATE value="Closed">
<FIELDS>
<FIELD refname="Demo.ClosedByValidation">
<COPY from="currentuser" />
</FIELD>
</FIELDS>
</STATE>
How it works
This is not possible afaik.
However the opposite idea is possible "Restrict a transition when currentUser is not same as CreatedBy" with "NOTSAMEAS" rule. (I still don't know why MS didn't implement a "SAMEAS" rule)
So, since there is no "SAMEAS" rule, you can not do it using xml modifications.
Btw, I hope I'm wrong but it's also not available to interrupt work item save event and cancel it (As @MrHinsh suggested). Work Item Save event is just a Notification event and not a DecisionPoint event and also it happens after the work item save operation completed as name suggests (WorkItemChangedEvent).
Details about the NotificationType can be read here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With