Is there any possibility to add text into priorities? It would be good to have values like开发者_JS百科 "1 - Blocker", "2 - Critical", "3 - High", ... etc.
Attempt to change "ALLOWEDVALUES" of "Priority" field (refname="Microsoft.VSTS.Common.Priority") to something like
<ALLOWEDVALUES>
<LISTITEM value="1 - Blocker" />
<LISTITEM value="2 - Critical" />
<LISTITEM value="3 - High" />
<LISTITEM value="4..." />
<LISTITEM value="5..." />
<LISTITEM value="6..." />
</ALLOWEDVALUES>
Give an error that field should be integer.
I see few options: 1. change field type to string 2. create a separate custom field "MyPriority" with 'string' type.
Could you please advise what is the best option (from long term usage perspective)?
Thanks a lot!
You cannot change the type of an existing field. What I did in the past is adding a new field which is shown on the form. Then Add some logic to the field to copy
Add the following text to the FIELDS section
<FIELD name="My Priority" refname="My.Priority" type="String" reportable="dimension">
<REQUIRED />
<ALLOWEDVALUES>
<LISTITEM value="1 - Blocker" />
<LISTITEM value="2 - Critical" />
<LISTITEM value="3 - High" />
<LISTITEM value="4..." />
<LISTITEM value="5..." />
<LISTITEM value="6..." />
</ALLOWEDVALUES>
<DEFAULT from="value" value="3 - High" />
</FIELD>
And change the default priority field to
<FIELD name="Priority" refname="Microsoft.VSTS.Common.Priority" type="Integer" reportable="dimension">
<REQUIRED />
<ALLOWEDVALUES>
<LISTITEM value="1" />
<LISTITEM value="2" />
<LISTITEM value="3" />
<LISTITEM value="4" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="2" />
<WHEN field="My.Priority" value="1 - Blocker">
<COPY from="value" value="1" />
</WHEN>
<WHEN field="My.Priority" value="2 - Critical">
<COPY from="value" value="2" />
</WHEN>
<WHEN field="My.Priority" value="3 - High">
<COPY from="value" value="3" />
</WHEN>
<WHEN field="My.Priority" value="4...">
<COPY from="value" value="4" />
</WHEN>
</FIELD>
Locate the Priority in the FORMS section and change it to use the My.Priority:
<Control Type="FieldControl" FieldName="My.Priority" Label="Pri&ority:" LabelPosition="Left" />
I dont think you can change type of an existing field. So 2nd option is the only option. In my company I have customized work item types extensively and have used quite a few custom fields. It works well. Having said that, you will need to load your new field with existing priority data (if there is any).
A simple stored proc to copy data from Microsoft.VSTS.Common.Priority field to "New custom field" should do the job. WorkItemsLatestUsed table should be the only table touched for this purpose.
精彩评论