Readonly flag for System.ChangedBy field not possible?  
Author Message
thomaskremmel





PostPosted: Team Foundation Server - Work Item Tracking, Readonly flag for System.ChangedBy field not possible? Top

i do want to display the changedby field in my form. but it should be readonly. i tried the following code but i always get an error message when trying to save the work-item.

<FIELD name="Changed By" refname="System.ChangedBy" type="String">
<VALIDUSER/>
<READONLY />
</FIELD>

error message:
Save failed.
The value for field 'Changed by' must be the same as the original value.

but i didn`t changed the value of this field. obviously because it is read only ;-)

is it not possible to set a system field to readonly


Visual Studio Team System38  
 
 
Sagar Sura





PostPosted: Team Foundation Server - Work Item Tracking, Readonly flag for System.ChangedBy field not possible? Top

Very interesting. System.ChangedBy field is core field and this field gets the current user when a work item is changed (happens in the background). As you mentioned READONLY and in the background you are trying to assign the current user the field value is changes - as this is conflicting with READONLY rule you have given you get the error.

I think we cannot set this as ready only. I will see if I can file a bug on this

Thanks

Sagar



 
 
Mohammad Iqubal - MSFT





PostPosted: Team Foundation Server - Work Item Tracking, Readonly flag for System.ChangedBy field not possible? Top

Instead of making the field readonly in the field definition, I would suggest you to make the field readonly in the work item form by using adding setting the readonly flag to true. So this how it will look like in your WIT definition:-

Field definition

<FIELD name="Changed By" refname="System.ChangedBy" type="String" reportable="dimension">
<VALIDUSER />
</FIELD>


Form layout definition

<Control Type="FieldControl" FieldName="System.ChangedBy" Label="Changed by:" LabelPosition="Left" ReadOnly="True" />

Mohammad


 
 
thomaskremmel





PostPosted: Team Foundation Server - Work Item Tracking, Readonly flag for System.ChangedBy field not possible? Top

thank you! works fine!