Make a new field depending on "Assigned To"

I added a new field called "Responsibility" to the Bug workitem. And I was trying to make it dependent on "Assigned To". Say, when "Assigned To" is set to user A, "Responsibility" will show "QA". Below is what I did for the new field, but it doesn't work properly. My problem here is the new field value won't get updated correctly, unless I empty the "Assigned To" box first and then select user.

Any help is greatly appreciated.

<FIELD name="Responsibility" refname="MyCompany.VSTS.CMMI.Responsibility" type="String" reportable="dimension">
<HELPTEXT>The responsibility of the defect</HELPTEXT>
<ALLOWEDVALUES>
<LISTITEM value="DEV" />
<LISTITEM value="PM" />
<LISTITEM value="QA" />
</ALLOWEDVALUES>
<WHEN field="System.AssignedTo" value="">
<EMPTY />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserA">
<DEFAULT from="value" value="QA" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserB">
<DEFAULT from="value" value="QA" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserC">
<DEFAULT from="value" value="PM" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserD">
<DEFAULT from="value" value="DEV" />
<REQUIRED />
</WHEN>
</FIELD>

[1525 byte] By [Smartway] at [2007-12-20]
# 1

hi,

I think you can defined the following section in <WORKFOLOW> not in <FIELDS>, that would be better.

-

<WHEN field="System.AssignedTo" value="">
<EMPTY />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserA">
<DEFAULT from="value" value="QA" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserB">
<DEFAULT from="value" value="QA" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserC">
<DEFAULT from="value" value="PM" />
<REQUIRED />
</WHEN>
<WHEN field="System.AssignedTo" value="Domain\UserD">
<DEFAULT from="value" value="DEV" />
<REQUIRED />
</WHEN>

-

Thanks,

Ed

edwardzhou at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 2
Hi Ed,

Doesn't workflow section only take <STATES> and <TRANSATIONS>? Whereabout should I place the code to make it only depending on "Assigned To" instead of "System.State". My understanding is that anything in the <WorkFlow> section only gets triggered when System.State changes. Correct me if I am wrong.

Thanks

Smartway at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 3

You're right that WORKFLOW only applies to state transitions. In the original example, simply change DEFAULT to COPY. (Default won't overwrite an existing value).

<WHEN field="System.AssignedTo" value="Domain\UserA">
<COPY from="value" value="QA" />
<REQUIRED />

AllenClarkMSFT at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 4
It works like a charm!!! Thanks Allen!!!
Smartway at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...

Visual Studio Team System

Site Classified