2


I have work item type template where i want to assign right to change drop down list to default value as "Requested" for new item and every one can see and read it. If user is in group "[TEAM FOUNDATION]\Approvers" or "[TEAM FOUNDATION]\Developers" they are able to change this item.

I have a problem if user is not in either of the groups it will fail and blank display disabled field. How do i define these permissions?

My definition of field is below.

<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
    <REQUIRED />
    <DEFAULT from="value" value="Requested" />
    <ALLOWEDVALUES>
      <LISTITEM value="Approved" />
      <LISTITEM value="Requested" />
      <LISTITEM value="Rejected" />
    </ALLOWEDVALUES>        
    <DEFAULT from="value" value="Requested" />
    <READONLY not="[TEAM FOUNDATION]\Approvers" />
    <READONLY not="[TEAM FOUNDATION]\Developers" />
    <HELPTEXT>Shows whether the task has been approved by management.</HELPTEXT>
  </FIELD>
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
cpoDesign
  • 8,953
  • 13
  • 62
  • 106

1 Answers1

0

This seems like a heavy one.What is your exact intend? Maybe using a WHEN block or splitting the restrictions into basic ones (at the field definition) and special ones at state or transition level will solve your problem?

<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
    <REQUIRED />
    <DEFAULT from="value" value="Requested" />
    <WHENNOT field="System.State" value="New">
      <READONLY not="[TEAM FOUNDATION]\Developers"/>
      <READONLY not="[TEAM FOUNDATION]\Approvers"/>
    </WHENNOT>
    <HELPTEXT>Shows whether the task has been approved by management.</HELPTEXT>
</FIELD>

or

<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
    <REQUIRED />
    <ALLOWEDVALUES>
      <LISTITEM value="Approved" />
      <LISTITEM value="Requested" />
      <LISTITEM value="Rejected" />
    </ALLOWEDVALUES>        
    <DEFAULT from="value" value="Requested" />
    <HELPTEXT>Shows whether the task has been approved by management.</HELPTEXT>
</FIELD>

<TRANSITION from="" to="New">
    <FIELDS>
        <FIELD refname="Approval">
            <READONLY not="[TEAM FOUNDATION]\Developers"/>
            <READONLY not="[TEAM FOUNDATION]\Approvers"/>
        </FIELD>
</TRANSITION>

By the way: You should refName your fields with a whole "Namespace", e.g. "My.Company.TfsFields.Common.Approval" or "My.Company.TfsFields.Bugs.IsRegression"

eFloh
  • 2,098
  • 20
  • 24
  • The purpose of this is Create options that is accessible by management people to approve that they want developers to work on this item, with option for developers to modify it as there might be options where they need to override management decision. – cpoDesign Sep 19 '11 at 17:41
  • why i should user refname as namespace? – cpoDesign Sep 20 '11 at 07:15
  • 1
    This will enable thrid party addons to work together with your own fields or other thirs party fields: Assume you created the field "Approval" and afterwards try to install/incorporate an extension that uses an Approval field itself (e.g. for internal purposes with other data type) This was be no problem if your field is "MyCompany.Approval" and the other field was "OtherExtension.Approval", but would cause big trouble when not using a namespace. (Remember: you can't change a field name or refname after creation) (http://msdn.microsoft.com/en-us/library/ms194941(v=VS.100).aspx#ReferenceName) – eFloh Sep 21 '11 at 10:53