TFS Assign Work Item By STATE ... with conditions - tfs

Our TFS is currently set up to assign a work item to our Tester (by capacity planning role) when the item goes from Active to Resolved state.
This is great, but it doesn't go far enough. When the Tester moves the item from Resolved to either Closed (tested and verified fixed) or Active (failed testing) I want to reassign the item back to whoever most recently transitioned it from Active to Resolved.
This way the person who fixed it is still associated with it when the defect is closed (get credit for your work) or if you didn't pass testing it gets reassigned back to the person that will be re-doing the work.
How can this be done?

Yes, your requirement can be achieved.
Automatically change AssignedTo field to a user when State field changes from Active to Resolved.
Assuming you have installed TFS Power Tool. You can modify the Transition from Active to Resolved (my example is from To Do to In Progress) by adding AssignedTo field and rules to this Transition:
The XML file should be like:
<Transition from="To Do" to="In Progress">
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.StartWork" />
</ACTIONS>
<REASONS>
<DEFAULTREASON value="Work started" />
</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<DEFAULT from="value" value="{Tester}" />
</FIELD>
</FIELDS>
</Transition>
In my example, when the State changes from To Do to In Progress, the AssignedTo field will change to Tester.
When the Tester changes State from Resolved to Active, the AssignedTo field will change back to whoever most recently change it
from Active to Resolved.
First, you need to customize a field to get ChangedBy value. In my example, I've customized a field named copy, the XML file looks like:
<FieldDefinition name="copy" refname="copy.copy" type="String">
<COPY from="field" field="System.ChangedBy" />
</FieldDefinition>
Then, similar to the item 1 above, you need to modify the Transition from Resolved to Active to (my example is from In Progress to To Do), the XML file looks like:
<Transition from="In Progress" to="To Do">
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.StopWork" />
</ACTIONS>
<REASONS>
<DEFAULTREASON value="Work stopped" />
</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<COPY from="field" field="copy.copy" />
</FIELD>
</FIELDS>
</Transition>
In my example, when the State changes from In Progress to To Do, the AssignedTo field will change to the user who change it most recently.

Might be there Solution for your question, but what I know is you don't need that just to see the person will be associate with it .
This is because if you see on right pane,when someone check-in the code for that work-item, or makes changes to that and saves the work-item ,automatically TFS shows in arrow with Steps continuously what have been done and by whom with date
and after failed testing. Developer who checked-in the code or try to solve that issue you can just select that developer name on dropdown on assign
I guess you were almost wanting similar the way i told but again if not forgive me.
Thanks,

Related

Can you add validation for swimlanes in TFS 2018?

I have a "Blocked" swimlane that I would like to add validation to. Specifically, I'd like to make a field required to be filled in when a backlog item is moved into this swimlane. Is this possible in TFS 2018? I've looked in the "TFS Process Template Editor" extension but I can't see how to do this. Thanks
Yes, it's possible, I prefer to do it with exportwitd and importwitd.
Export the work item XML with exportwitd.
Add a transition with your Blocked state and make a field required.
<TRANSITION from="In Progress" to="Blocked">
<REASONS>
<DEFAULTREASON value="Fixed"/>
</REASONS>
<FIELDS>
<FIELD refname="MyCorp.SomeField" >
<REQUIRED />
</FIELD>
</FIELDS>
</TRANSITION>`
Import the XML again to TFS with importwitd.
Now when a user moves the work item from "In Progress" to "Blocked" the field "MyCorp.SomeField" will be required.
You can find good documenation regarding above here, here and here.

TFS. How to set <required changes> field if value has been already set?

I have some custom field in Bug WI. I want to set it to but even if there was not NULL value after state of WI changed.
Example: Let's say I have that config in transition:
<TRANSITION from="Active" to="Resolved">
<FIELD name="Version">
<REQUIRED />
</FIELD>
</TRANSITION>
When bug change it's state from Active to Resolved first time it works (field become yellow - fill required to proceed), but after, if I change state to New, then to Active and then to Resolved, there is no request to CHANGE previous field value. I think it's need check with previous value, and if it's equal, then require from user another value. Any suggestions how to do that?
Thanks
Found a solution.
Created hidden field "TempVersion". In transition Resolved to New/Active I copy value of Version to TempVersion.
<FIELD refname="TempVersion">
<COPY from="field" field="Version" />
</FIELD>
In transition Active->Resolved added :
<TRANSITION from="Active" to="Resolved">
<FIELD name="Version">
<NOTSAMEAS field="TempVersion" />
<REQUIRED />
</FIELD>
</TRANSITION>
Seems like it works!
REQUIRED rule requires a user to specify a value for the field. Users cannot save a work item until they have assigned values to all required fields. In your scenario, as the field "Version" has been specified a value, there is no restriction.
Default work item rules can't compare values, you'll need to customize a work item control to achieve what you want. You can get start by following https://witcustomcontrols.codeplex.com/

TFS User Can't Save Updated Work Item State

I have a user who is attempting to change the State of a TFS Change Request from Development to Testing but when he presses Save gets the following error:
Save failed: The field 'Changed By' contains a value that is not in the list of supported values
From what I can work out (please correct me if I'm wrong) Changed By relates to the History tab showing what has changed on the item.
So I've Exported the Work Item Types for our project, and opened the XML for Change Requests. When I searched for Test the State is listed as this:
<STATE value="Test">
<FIELDS>
<FIELD refname="System.AssignedTo">
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="[project]\Contributors" />
</ALLOWEDVALUES>
</FIELD>
</FIELDS>
</STATE>
And the Transition from Development to Test is as follows:
<TRANSITION from="Development" to="Test">
<REASONS>
<DEFAULTREASON value="Signed Off" />
<REASON value="Executive Signed Off" />
</REASONS>
<FIELDS>
<FIELD refname="System.ChangedBy">
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="[project]\Owners" />
</ALLOWEDVALUES>
</FIELD>
<FIELD refname="System.AssignedTo">
<REQUIRED />
</FIELD>
</FIELDS>
</TRANSITION>
I have checked both groups ([project]\Owners and [project]\Contributors). They are not a member of the Contributors group, but I checked another user who isn't having this issue and they are not either, so I think I can rule out that permissions group? And the Owners group has them listed (albeit under the group for their team) so I think that is correct.
The Field called ChangedBy populates from the Owners group and the user appears in that list (when checked from another point).
What could be causing this save issue? Am I missing something obvious?
Based on that XML, that says that only people in the Contributors group can save a WI in the Test state. If your user isn't a contributor that explains the error.
Try adding your user the Contributor group and try again.

TFS Workitems always leave 'Closed By' blank

We have a TFS workitem workflow where developers set workitems to be 'done'. It is largely our of the box with little custom configuration. This populates the 'Closed Date' but not 'Closed By'. The workflow continues as testers assign it to themselves and set the state to be 'Tested', but now I can no longer see on a report which developer closed the item.
How can I get a report of who did the work?
Given that you have a "Tested" state, it seems that the transitions have been customized. Ensure that all transitions to the "Closed" state have the correct rule on them to update the "Closed By" field. The Closed By definition on the transition should look something like this:
<STATE value="Closed">
<FIELDS>
....
<FIELD refname="Microsoft.VSTS.Common.ClosedBy">
<ALLOWEXISTINGVALUE />
<COPY from="currentuser" />
<VALIDUSER />
<REQUIRED />
</FIELD>
....
</FIELDS>
</STATE>
More information on customizing work item transitions can be found here and here.

Failed to update the following work item error while tfs check-in

I have modified the tfs bug work item template as below so that while resolving a bug from active to resolved state root cause field is not empty.
AS Microsoft.VSTS.Actions.Checkin action is defined user can checkin in team explorer marking the work item as resolved.This cause error
Failed to update the following work item:
ID 39169. Reason: TF237124: Work Item is not ready to save
How can i allow user to update the root cause field while check-in from team explorer pend changes window
<TRANSITION from="Active" to="Resolved">
<REASONS>
....
</REASONS>
<FIELDS>
....
<FIELD refname="RootCause">
<REQUIRED />
</FIELD>
</FIELDS>
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.Checkin" />
</ACTIONS>
</TRANSITION>
You are not able to update additional fields when you are associating work items with a checkin. I would recommend that you head over to http://visualstudio.uservoice.com and suggest that.
With your template above your developers would need to open and update the work item before the association to make it valid.
note: Your are also disabling Gated Checkin with this configuration.

Resources