TFS 2013 auto assign to myself - tfs

My question is, if it is possible in the TFS 2013 Scrum process template, to make a work item (task) on the scrum board, automatically assign to myself when moving it from "to do" to "in progress"? Should it be possible to add this in the process template on TFS?
We are using an on premise TFS 2013 environment.
I thought I have seen the configuration somewhere but I can't find it on the internet (maybe I am using the wrong search keywords).

You will need to edit the process template for the Task Work Item Type Definition.
Use witadmin.exe exportwitd to download the Task definition
Find the Transition from "To Do" to "In Progress" and change it like so:
<TRANSITION from="To Do" to="In Progress">
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.StartWork" />
</ACTIONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<COPY from="currentuser" />
</FIELD>
</FIELDS>
<REASONS>
<DEFAULTREASON value="Work started" />
</REASONS>
</TRANSITION>
Use witadmin.exe importwitd to re-import the Task definition.

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.

Defining VSTS Field only when Value of field is not Set

I have a need to set the value of a date field when the value of substate field changes only if no value already exists in the date field. Is it possible?
<FIELD refname="MyCorp.StateDate" name="Date Of Last State Change" type="DateTime">
<WHENCHANGED field="MyCorp.State">
<COPY from="clock" /> ** AND do this only of MyCorp.StateDate != Empty **
</WHENCHANGED>
</FIELD>
I read https://msdn.microsoft.com/en-us/library/ms194966.aspx but I am not able to find any way to implement what I need from the WIT language definition.
If you are using Visual Studio Team Services, add rules to work item is not supported now.
If you are using on-premise TFS, you can add field action in state transition, for example:
<TRANSITION from="New" to="Committed">
<REASONS>
<DEFAULTREASON value="Commitment made by the team" />
</REASONS>
<FIELDS>
<FIELD refname="starain.ScrumStarain.StateChageDate">
<WHEN field="starain.ScrumStarain.StateChageDate" value="">
<COPY from="clock" />
</WHEN>
</FIELD>
</FIELDS>
</TRANSITION>

Adding a state to a Work Item workflow in TFS 2013

My team recently migrated from TFS 2008 to TFS 2013. We are using the Agile template.
I noticed that for items that are Bugs, there isn't a way to specify that the item is "In Progress" or that "Work has started", it simply goes from the Active state to the Resolved state. I'm not sure what the logic is by not having an "In Progress" state between "Active" and "Resolved".
Anyways, I would like to add a new "In Progress" state but can't figure out how. Do any of you have any examples? I'm opening the Work Item Type Template in the Process Editor in Visual Studio. Do I need to manually edit the XML to add the state and try it until I get it right? Any examples?
Firstly, the following code shows you the workflow for Bug work item in Agile template. As the image shows, the states for Bug in Agile are Active, Resolved and Closed.
For your requirement to customize bug work item to change the workflow, you basically have two options: 1). Work with the work item type definition XML file as you mentioned above; 2). Work with Process Editor.
The details:
1). if you work with work item type definition XML file, you need to replace TRANSITIONS part with the followings (also assign appropriate actions & reasons you want):
<TRANSITIONS>
<TRANSITION from="" to="Active">
<REASONS>
<REASON value="Build Failure" />
<DEFAULTREASON value="New" />
</REASONS>
<FIELDS> . . . </FIELDS>
</TRANSITION>
<TRANSITION from="Active" to="In Progress">
<ACTIONS> . . . </ACTIONS>
<REASONS> . . . </REASONS>
</TRANSITION>
<TRANSITION from="In Progress" to="Resolved">
<ACTIONS> . . . </ACTIONS>
<REASONS> . . . </REASONS>
</TRANSITION>
<TRANSITION from="Resolved" to="In Progress">
<REASONS> . . . </REASONS>
</TRANSITION>
<TRANSITION from="Resolved" to="Closed">
<REASONS>
<DEFAULTREASON value="Verified" />
</REASONS>
<FIELDS> . . . </FIELDS>
</TRANSITION>
<TRANSITION from="Closed" to="Active">
<REASONS>
<REASON value="Reactivated" />
<DEFAULTREASON value="Regression" />
</REASONS>
<FIELDS> . . . </FIELDS>
</TRANSITION>
</TRANSITIONS>
2). If you want to work with Process Editor, you can add State on the Workflow tab. You can drag to add one State in WITDesigner pane from the Toolbox; and use Validate to check whether there is any error. See:
In one of the TFS 2013 Updates (I believe it is Update 4), we have updated the Agile template to include the New state to the Bug work item type to address this issue.
To add the state to your work item type, you can take two approaches:
Use witadmin or the power tools to manually add the New state
Download the latest Agile process template, and replace the Bug work item type on your TFS instance with the item from the downloaded template. You can get the latest copy of the Agile process template by creating an account on Visual Studio Online

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.

TFS 2010 clear SystemAssignedTo in transition

We have introduced a "Code review" state for tasks, between "In progress" and "Done". When moving from "In progress" to "Code review" we would like to clear/unassign System.AssignedTo but I can't figure out how. Does anyone know where to put the logic in the WIT xml and what it should look like?
Thanks,
Mansos
Open your schema in an XML editor. Go down to the <TRANSITIONS> part and add
<TRANSITION from="In Progress" to="Code Review">
<FIELDS>
<FIELD name="Assigned To">
<EMPTY />
</FIELD>
<FIELDS>
</TRANSITION>
Make sure you don't have any <REQUIRED> for that field anywhere in the definition (there are a number of ways you can have that rule).
For reference, see http://msdn.microsoft.com/en-us/library/aa337653%28v=vs.80%29.aspx

Resources