index > Team Foundation Server - Work Item Tracking > Changing State according to a field's value

Changing State according to a field's value


All,

I have 'bug' work items which are in a 'Resolved' state. I would like to change the state according to another field's value, for example if the value of 'Testing' becomes 'test failed', i would like to change the state to active automatically.

I had hoped to achieve it with something like this:

<FIELD name="State" refname="System.State" type="String" reportable="dimension">
<HELPTEXT>The workflow state of the bug</HELPTEXT>
<WHEN field="MyCompany.WorkItems.Testing" value="Test Failed">
<COPY from="value" value="Active"/>
</WHEN>
</FIELD>

...but there are constraints on the System.State field that don't allow me to do this. Next i thought about adding an action to the relevant transition something like this:

<TRANSITION from="Resolved" to="Active">
<ACTIONS>
<ACTION value="MyCompany.WorkItems.Actions.TestingFailed"/>
</ACTIONS>
<REASONS>
<DEFAULTREASON value="Testing Failed" />
</REASONS>
</TRANSITION>

...and then invoke this action from the field definition, something like this:

<FIELD name="Tested" ...>
...
<LISTITEM value = "Test Failed" />
...
<WHEN value="Test Failed">
<ACTIONS>
<ACTION value="MyCompany.WorkItems.Actions.TestingFailed" />
</ACTIONS>
</WHEN>
</FIELD>

..but ACTIONS are not valid here. Any ideas?
Peter Chapman

You cannot do that - the rules engine was not designed for doing that. System.State is a system field which depends only on System.WorkItemType, and this cannot be changed.

Thanks,

Alex

Aliaksei Baturytski - MSFT
I don't understand your answer. If you cannot change an item's state then there wouldn't be much point having transitions, or anything else for that matter.

My question in another way:

Can I get an item's state to auto-transition in response to an action, much like this does:

<
Peter Chapman

You cannot change State in response to change in other field's value - the OM and work item type definition have no support for that. You would have to write your own app to do that.

Actions were added for the integration with the version control; right now the only action recognizeable by the system is Microsoft.VSTS.Actions.Checkin. You may define your own actions, but they will have no effect on system's behavior. However, you could use them in your application to determine the state the action should bring your item to (WorkItem.GetNextState, WorkItemType.GetNextState). Therefore I don't think you could use actions to achieve your goal.

Thanks,

Alex

Aliaksei Baturytski - MSFT
Thanks
Peter Chapman
reply 5

You can use google to search for other answers

 

More Articles

Is there a web interface to VSTS defect tracking?
has anybody created a conversion tool that import bugzilla bugs a...
Actions and fields of work items
How do I delte work items?
Team Queries in Custom project template referencing iteration pat...
How to Import/Export WorkItems in TFS-RTM
Way to change the order of "found in build" field on WI
Readonly field and emphasizing font color
Global Lists & Default Values
Unpublished changes in Project
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Automatically generate a work item on st…
Comparing fields of a Work Item when fil…
TF54000: Error TFS Clock time advanced
How to get the attachment file name usin…
How to mark work item as resolved
How to track completed workitem
Methodology for publishing work items
Searching Work item history
How to make a Dropdown list containing b…
How do I delete a task?
Walkthru question on "To save a doc…
Task "WITs" from Group "W…
Field won't copy from another field on N…
Automatically create a work item during …
Assigned To getting blanked out when clo…

Hot Articles

Why there is no Date related fields when…
Query for attachments
create WI custom field dependencies
Mapping of TFS text fields on MS Project…
calculating hours with subtasks
Query for all items that've had been ass…
MS Project Mapping Problem
How to get access to the selected workit…
Work Item Dependency
Work item description formatting
How To Temporarily Disable Field Validat…
Having no one assigned to a Work Item
Locating Work Item Attributes In TFS Dat…
Start Date is read-only from MS Project
How to get the next allowed state from t…

Recommend Articles

Print Work Item Per Page
Credentials of the SubscribeEvent WebSer…
Bugs and related work item resolution...
Can users add and view work items from t…
Error adding attachment with work item?
Documentation for WIT types
Creating a Custom query programmatically…
Uniquely identify new work item
How to delete previously imported items …
How to display Specific Revision of work…
Adding new Values to "state"
Work Item Update Collisions
Assignment and delegation: Is teher any …
Get Workflow using code
Automate "Add solution to Source co…