Noticed StateChanged field is missing within XML definitions of some work items in scrum template of tfs 2017 RTM : pbi, testplan, testsuite, feebackrequest, codereviewrequest, and some more.
I assume i should add it manually to them. Right ?
If you mean the State Change Date field, yes, by default it's not added in some work items in scrum template.
Actually the control is not added to layout eventhough in the existing work items such as Bug, Feature. That means, you cannot see the field in work item layout. However you can add the control to display the field based on your requirements.
Yes, you can also add the State Change Date field manually to the work items which not exsiting in them. See Add a field, or apply a rule, or change an attribute for details.
You can also use the TFS Process Template Editor to edit the WITs definitions.
Field:
<FieldDefinition name="State Change Date" refname="Microsoft.VSTS.Common.StateChangeDate" type="DateTime">
<WHENCHANGED field="System.State">
<SERVERDEFAULT from="clock" />
</WHENCHANGED>
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FieldDefinition>
Layout Control:
<Group Label="Status">
<Column PercentWidth="100">
<Control FieldName="Microsoft.VSTS.Common.StateChangeDate" Type="DateTimeControl" Label="State Change Date:" LabelPosition="Left" />
</Column>
</Group>
Page Section:
<Section>
<Group Label="Status">
<Control Label="State Change Date:" Type="DateTimeControl" FieldName="Microsoft.VSTS.Common.StateChangeDate" />
</Group>
</Section>
Related
Here is how I added [AHA Reference] column (custom column) to my local TFS, which I learned from
https://learn.microsoft.com/en-us/vsts/work/customize/reference/witadmin/witadmin-import-export-manage-wits?view=tfs-2018
1) run below command to export the WIT
witadmin exportwitd /collection:http://XXXXX:8080/tfs/DefaultCollection /p:LocalTestProject /f:c:\temp\myworkitems_local.xml /n:Feature
2) In the generated xml file, I added this to the FIELDS node
3) then I added a Control node under FORM
4) then in the TFS, I added [AHA Reference] column, and I can see it in the list.
5) Since I added control in step 3, my understanding is that in the detail popup, it should show the [AHA Reference] under ‘value area’. It never showed up. But, the [AHA Reference] field is added and I can retrieve it from code.
Maybe my understanding is not correct. Not an important question. I’m just curious what that ‘Control’ node in WIT does if not adding the ‘control’ to UI.
Thanks
It's because you added the Control under the old form/team explorer in step 3. If you back to old form, you'll see this field. In order to make the Control shows in new web form, you need to add the control under <FORM><WebLayout>...</WebLayout></FORM>:
<FORM>
<WebLayout>
<Page Label="Details" LayoutMode="FirstColumnWide">
<Section>
<Group Label="Details">
<Control Label="Priority" Type="FieldControl" FieldName="Microsoft.VSTS.Common.Priority" />
<Control Label="Effort" Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.Effort" />
<Control Label="Business Value" Type="FieldControl" FieldName="Microsoft.VSTS.Common.BusinessValue" />
<Control Label="Time Criticality" Type="FieldControl" FieldName="Microsoft.VSTS.Common.TimeCriticality" />
<Control Label="Value area" Type="FieldControl" FieldName="Microsoft.VSTS.Common.ValueArea" />
<Control Label="AHA Reference" Type="FieldControl" FieldName="AHAReference.AHAReference" />
</Group>
</Section>
</Page>
</WebLayout>
</FORM>
Useful links:
https://learn.microsoft.com/en-us/vsts/work/customize/customize-wit-form?view=vsts
https://learn.microsoft.com/en-us/vsts/work/customize/reference/weblayout-xml-elements?view=vsts
I am trying to edit work item templates to make use of the new Boolean field in TFS 2017, and want a particular field to be set to true before a status can be changed. Is there any way to do this? It would appear ALLOWEDVALUES and MATCH aren't supported, which could have potentially helped
You can do that by applying a conditional rule based on your requirement just as Hamid mentioned above.
Boolean is just a data type, we can add a custom Boolean field and add a checkbox for it.
Use the following syntax to add a Boolean field within the FIELDS
section of the WIT definition.
<FIELD name="Triagelc" refname="lc.Triage" type="Boolean" >
<DEFAULT from="value" value="True" />
<HELPTEXT>Triage work item</HELPTEXT>
</FIELD>
And then add the following syntax within the FORM section to have
the field appear on the form.
<Control Label="Triagelc" Type="FieldControl" FieldName="lc.Triage" />
The field will appear as a checkbox on the form.
Then apply a When rule for target filed, thus when the specified
Boolean field has the specified value, the When rule is applied to
the target field.
eg1:
Apply a "When" rule for Description field in Task work item type :
<FieldDefinition name="Description" refname="System.Description" type="HTML">
<WHEN field="lc.Triage" value="True">
<REQUIRED />
</WHEN>
</FieldDefinition>
Then when set the value to True, the Description area is required, it cannot be empty.
eg2:
You can also use READONLY rule to restrict other areas:
<FieldDefinition name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<WHEN field="lc.Triage" value="True">
<READONLY />
</WHEN>
<ALLOWEXISTINGVALUE />
<HELPTEXT>The person currently owning this task</HELPTEXT>
</FieldDefinition>
Thus, when the Boolean field value is True, Assigned To field is read only, otherwise you can assign to the existing users.
UPDATE:
eg3:
We can not achieve that directly with the boolean data type. As a workaround you can try below ways:
Apply the When rule and embed the Copy rule (Copy True as the
value) for the "Triagelc" boolean field in this example. Thus when
the status is Done, Triagelc can set the value to "True"
automatically, then save. But in this way the value still can be
modified to false. Reference below screenshot 1:
<FieldDefinition name="Triagelc" refname="lc.Triage" type="Boolean">
<WHEN field="System.State" value="Done">
<COPY from="value" value="True" />
</WHEN>
<HELPTEXT>Triage work item</HELPTEXT>
</FieldDefinition>
Set the default value to True for Boolean field (Triagelc
field in this example), then apply When rule with READONLY rule
embedded. This way should be meet your requirement (Once done the value cannot be changed anymore). Reference below screenshot 2:
<FieldDefinition name="Triagelc" refname="lc.Triage" type="Boolean">
<DEFAULT from="value" value="True" />
<WHEN field="System.State" value="Done">
<READONLY />
</WHEN>
<HELPTEXT>Triage work item</HELPTEXT>
</FieldDefinition>
Please note that:
The Boolean data type field is only supported for VSTS and TFS 2017.2
and later versions.
Screenshot 1:
Screenshot 2:
I have a custom TFS form. In this form i need to add a check box as
Select test:
Test1
Test2
Test3
Test1, Test2 and Test3 should be check box controls and the user can select any number of check boxes. How can I achieve this in TFS? I installed a code plex project http://witcustomcontrols.codeplex.com/
But there is no documentation on how I can use the controls or samples.
The download file from http://witcustomcontrols.codeplex.com/ contains an installer for the Windows controls and a .zip file for the Web Access controls.
To install windows control:
Simply run the msi setup and restart Visual Studio.
Fields associated with multivalue control should have list of suggested values and each value enclosed in square brackets. For example:
<FIELD name="Triage" refname="Microsoft.VSTS.Common.Triage" type="String" reportable="dimension">
<HELPTEXT>Status of triaging the bug</HELPTEXT>
<SUGGESTEDVALUES expanditems="false">
<LISTITEM value="[Approved]" />
<LISTITEM value="[Investigate]" />
<LISTITEM value="[Rejected]" />
<LISTITEM value="[Submit]" />
</SUGGESTEDVALUES>
</FIELD>
Then use MultiValueControl as controltype for that field in Form section, for example:
<Control Type="MultiValueControl" FieldName="Microsoft.VSTS.Common.Triage" Label="Triag&e:" LabelPosition="Left" />
Check: http://witcustomcontrols.codeplex.com/wikipage?title=MultiValue%20Control
To install web control:
Navigate in your browser to the configuration panel for the web
extension of TFS: http://servername:8080/tfs/_admin/_extensions
Click on the Install and upload the CodePlex.WitCustomControls.MultiValueControl.zip-file, make
sure to use the .zip file matching you TFS server version.
Enable the extension.
Check: http://witcustomcontrols.codeplex.com/releases/view/616048
As of the recent release of TFS 2015 Update 2, this can be done with the witd in on-prem TFS like this (example is from a Bug).
Definition:
<FIELD name="CustomerReported" refname="X.X.CustomerReported" type="Boolean" reportable="dimension">
<DEFAULT from="value" value="True" />
</FIELD>
Layout:
<Control FieldName="X.X.CustomerReported" Type="FieldControl" Label="Customer Reported" LabelPosition="Left" />
I have custom TFS form with a text field comment. I want this field to be readonly for most of the area paths except 4. How can I add condition to set the field as read only?
basically, when the area id is 1,2,3,4 the comment field should not be readonly else it should be readonly.
I tried the following, but it didn't work
<FIELD name="Comment" refname="test.test.comment" type="Integer">
<WHENNOT field="System.AreaId" value="1">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="2">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="3">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="4">
<READONLY />
</WHENNOT>
</FIELD>
I dont want to write when conditions because these 4 are constant and I have about 40 other area ids which keeps increasing.
No, "And" multiple "WHENNOT" conditions doesn't work. See: Work Item state change rules in TFS - Any way to use "AND"s or "OR"s?
So, instead of using work item rules, you need to work with custom work item control. Determine when to set Comment filed to be readonly via using TFS API. Check this link for the details on how to work with custom work item control: https://witcustomcontrols.codeplex.com/
I have a weird problem with the configuration of TFS 2010 work items. It seems to be impossible to change the case of characters in the allowed values collection of a field e.g. change "Works for me" to "Works For Me". Every other string e.g. "Works For Me 123" is valid.
Even if I try to change the name to another string first (since i know the similar case problem with files in Visual Studio projects) it is just not accepting the upper case version and returns always to the lower case string.
Background information:
We have a custom WIT file to define the "Bug" work item. This includes the definition of the allowed values for the field "Resolved Reason". Initially our list contained lower case words e.g. "Works for me". Since we want to synchronize the TFS work items with HP Quality Center we need an exact match of the state names now.
The desired version:
<FIELD name="Resolved Reason" refname="Microsoft.VSTS.Common.ResolvedReason" type="String" reportable="dimension">
<HELPTEXT>The reason why the bug was resolved</HELPTEXT>
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="Duplicate" />
<LISTITEM value="Fixed" />
<LISTITEM value="Wont Fix" />
<LISTITEM value="Invalid" />
<LISTITEM value="Works For Me" />
<LISTITEM value="Forwarded" />
</ALLOWEDVALUES>
</FIELD>
The actual version:
<FieldDefinition reportable="dimension" refname="Microsoft.VSTS.Common.ResolvedReason" name="Resolved Reason" type="String">
<ALLOWEDVALUES>
<LISTITEM value="Duplicate" />
<LISTITEM value="Fixed" />
<LISTITEM value="Wont fix" />
<LISTITEM value="Invalid" />
<LISTITEM value="Works for me" />
<LISTITEM value="Forwarded" />
</ALLOWEDVALUES>
<HELPTEXT>The reason why the bug was resolved</HELPTEXT>
</FieldDefinition>
Any ideas are welcome.
Thanks,
Robert
As Grant explained, the old work items are stuck with the old casing.
A manual workaround would be to create a new ListItem with the desired case (leaving the old one in the definition for now), edit the existing work items that contain the undesired case to the newly created ResolvedReason, and finish by removing the undesired item from the definition. I have done a similar thing in the past, but not specifically a case change.
If you are familiar with the TFS API (I'm not), you can programmatically update the Microsoft.VSTS.Common.ResolvedReason field values on the server. If you have access to the SQL Server 2008 instance, you might be able to edit the field values there to the new case (many layers of bureaucracy prevent me from testing this for you).
Once a string in a work item type is created with a particular casing, it is stuck with that.