Mark Richman
Mark Richman

Reputation: 29710

Create TFS Bug fails validation with InvalidNotOldValue

I'm creating a new WIT of type Bug, setting a custom field "External ID" which is read-only.

When I call wit.Validate() it's failing on this field with InvalidNotOldValue:

Validation error:
Field:External ID
Old value:
New value:INC0172473
Status: InvalidNotOldValue

I would expect a new WIT to validate with an empty old value, even if it's read only.

Is there something I've misconfigured in the WIT TFS, or do I need to do something special before calling WorkItem.Validate()?

Similar thread over here on MSDN.

Upvotes: 3

Views: 6160

Answers (4)

Anton Spitsyn
Anton Spitsyn

Reputation: 1

It is likely, that SQL Server optimistic locking is an underlying error for this, when users changes state of workitem simultaneously. TF401320 ReadOnly AllowsOldValue InvalidNotOldValue

Upvotes: 0

Ole EH Dufour
Ole EH Dufour

Reputation: 3240

I noticed that the error occurs when someone else changes the status of the request. That somehow 'locks' the data you submitted, displaying the (very unclear) error.

Upvotes: 0

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29966

This is caused by the "Read-Only" rule for "Bug", since it is read only, you cannot update the value of it even you are create a new work item.

So you need to update the rule to work around it. For example, when you create a new work item, the Title field must be changed. So you can remove the "Read-Only" rule for "External ID" and add a "WHENNOTCHANGED" rule for it. Set the "Field Condition" to "System.Title" and "Rules" to "READONLY" for "WHENNOTCHANGED" rule. Now this will allow you to pass the work item validate and set the External ID when create the work item.

Upvotes: 3

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

The error caused by the work item is not valid successfully. And you can check the links below for more information about validating your work items: http://bartwullems.blogspot.in/2012/04/tf237124-work-item-is-not-ready-to-save.html

Upvotes: 1

Related Questions