Question

Updated question with additional info as solution was not applicable.

Sorry, I will have to ask this question once again. My objective is to implement some TFS automation for the Assigned To field. This field is to be populated certain values in the module and category field are selected.

Is there a way to create an "And" operator within the TFS WI XML that can handle this? I asked this question a couple of months ago and received an answer. Unfortunately, I haven't had time to implement it due to several items that came down the pipe. When I tried implementing the solution and when importing the WIT, TFS would throw a "WHEN" has an invalid child element "WHEN" error.

Example:

If "Module" field = value X and "Platform" field = value Y, then "Assigned to" field is set to specific user

Given solution does not work:

<FIELD name="QA Owner" refname="<QAOwnerFieldReference>" type="String">
<VALIDUSER />
<WHEN field="<ModuleReferenceName>" value="Compliance">
<WHEN field="<AnotherFieldName>" value="SomeValue">
<DEFAULT from="value" value="<QATester>" />
</WHEN>
</WHEN>
</FIELD>

I do have an idea, is it possible to merge the second "WHEN" condition with the first, such that:

<WHEN field="<ModuleReferenceName>" value="Compliance" && WHEN field="<AnotherFieldName>" value="SomeValue">

Link to previous post: Assigning users in TFS if two fields have specific values

Was it helpful?

Solution

The only viable solution I could find for this is to create a custom control that will process a set of rules before saving the work item.

Check out Gregg Boer's blog for a short guide to creating WI custom controls. Note that this will need to be installed on each desktop client's machine.

Note that you will want to write a handler for the BeforeUpdateDatasource event.

Also, if you need this to run on the web, you'll need to create a web-access custom control (see Ewald Hoffman's post on WA controls).

OTHER TIPS

What you need to do is to cascade two conditions, to create an and effect. Not ideal, but what'll you do :)

Here's what your WIT field definition could look like:

<FIELD name="QA Owner" refname="<QAOwnerFieldReference>" type="String">
<VALIDUSER />
<WHEN field="<ModuleReferenceName>" value="Compliance">
<WHEN field="<AnotherFieldName>" value="SomeValue">
<DEFAULT from="value" value="<QATester>" />
</WHEN>
</WHEN>
</FIELD>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top