Click here to Skip to main content
12,761,216 members (30,740 online)
Click here to Skip to main content

Stats

40.3K views
1.9K downloads
17 bookmarked
Posted 30 Sep 2010

Expression Control for TFS Work Items

, 5 Oct 2010 CPOL
Custom control for TFS Work Items that shows the result of calculating an expression based on the work item fields contents
<?xml version="1.0" encoding="utf-8"?>
<witd:WITD application="Work item type editor" version="1.0" xmlns:witd="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef">
  <WORKITEMTYPE name="Risk">
    <DESCRIPTION>Includes information to track the work to mitigate a risk.</DESCRIPTION>
    <FIELDS>
      <FIELD name="Title" refname="System.Title" type="String" reportable="dimension">
        <HELPTEXT>Short description of the risk used to differentiate it in a list or report</HELPTEXT>
        <REQUIRED />
      </FIELD>
      <FIELD name="State" refname="System.State" type="String" reportable="dimension">
        <HELPTEXT>The workflow state of the risk</HELPTEXT>
      </FIELD>
      <FIELD name="Rev" refname="System.Rev" type="Integer" reportable="dimension" />
      <FIELD name="Changed By" refname="System.ChangedBy" type="String" syncnamechanges="true" reportable="dimension">
        <ALLOWEXISTINGVALUE />
        <VALIDUSER />
      </FIELD>
      <FIELD name="State Change Date" refname="Microsoft.VSTS.Common.StateChangeDate" type="DateTime">
        <WHENCHANGED field="System.State">
          <SERVERDEFAULT from="clock" />
        </WHENCHANGED>
        <WHENNOTCHANGED field="System.State">
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Activated Date" refname="Microsoft.VSTS.Common.ActivatedDate" type="DateTime" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Activated By" refname="Microsoft.VSTS.Common.ActivatedBy" type="String" syncnamechanges="true" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <ALLOWEXISTINGVALUE />
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Reason" refname="System.Reason" type="String" reportable="dimension">
        <HELPTEXT>The reason why the risk is in the current state</HELPTEXT>
      </FIELD>
      <FIELD name="Resolved Date" refname="Microsoft.VSTS.Common.ResolvedDate" type="DateTime" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
        <HELPTEXT>The person currently working on this risk</HELPTEXT>
        <ALLOWEXISTINGVALUE />
        <VALIDUSER />
      </FIELD>
      <FIELD name="Work Item Type" refname="System.WorkItemType" type="String" reportable="dimension" />
      <FIELD name="Resolved By" refname="Microsoft.VSTS.Common.ResolvedBy" type="String" syncnamechanges="true" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <ALLOWEXISTINGVALUE />
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Closed By" refname="Microsoft.VSTS.Common.ClosedBy" type="String" syncnamechanges="true" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <ALLOWEXISTINGVALUE />
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Severity" refname="Microsoft.VSTS.Common.Severity" type="String" reportable="dimension">
        <HELPTEXT>How severe is the potential effect of this risk on the project?</HELPTEXT>
        <REQUIRED />
        <ALLOWEDVALUES expanditems="true">
          <LISTITEM value="1 - Critical" />
          <LISTITEM value="2 - High" />
          <LISTITEM value="3 - Medium" />
          <LISTITEM value="4 - Low" />
        </ALLOWEDVALUES>
        <DEFAULT from="value" value="3 - Medium" />
      </FIELD>
      <FIELD name="Stack Rank" refname="Microsoft.VSTS.Common.StackRank" type="Double" reportable="dimension">
        <HELPTEXT>Work first on items with lower-valued stack rank. Set in triage.</HELPTEXT>
      </FIELD>
      <FIELD name="Integration Build" refname="Microsoft.VSTS.Build.IntegrationBuild" type="String" reportable="dimension">
        <HELPTEXT>The build in which the bug was fixed</HELPTEXT>
        <SUGGESTEDVALUES expanditems="true">
          <LISTITEM value="&lt;None&gt;" />
        </SUGGESTEDVALUES>
      </FIELD>
      <FIELD name="Found In" refname="Microsoft.VSTS.Build.FoundIn" type="String" reportable="dimension">
        <HELPTEXT>The build in which the bug was encountered</HELPTEXT>
        <SUGGESTEDVALUES expanditems="true">
          <LISTITEM value="&lt;None&gt;" />
        </SUGGESTEDVALUES>
      </FIELD>
      <FIELD name="Created Date" refname="System.CreatedDate" type="DateTime" reportable="dimension" />
      <FIELD name="Created By" refname="System.CreatedBy" type="String" syncnamechanges="true" reportable="dimension" />
      <FIELD name="Priority" refname="Microsoft.VSTS.Common.Priority" type="Integer" reportable="dimension">
        <HELPTEXT>Priority for mitigating the risk, based on business goals</HELPTEXT>
        <ALLOWEDVALUES expanditems="true">
          <LISTITEM value="1" />
          <LISTITEM value="2" />
          <LISTITEM value="3" />
          <LISTITEM value="4" />
        </ALLOWEDVALUES>
        <DEFAULT from="value" value="2" />
      </FIELD>
      <FIELD name="Resolved Reason" refname="Microsoft.VSTS.Common.ResolvedReason" type="String" reportable="dimension" />
      <FIELD name="Closed Date" refname="Microsoft.VSTS.Common.ClosedDate" type="DateTime" reportable="dimension">
        <WHENNOTCHANGED field="System.State">
          <READONLY />
        </WHENNOTCHANGED>
      </FIELD>
      <FIELD name="Original Estimate" refname="Microsoft.VSTS.Scheduling.OriginalEstimate" type="Double" reportable="measure" formula="sum">
        <HELPTEXT>The original estimate of hours of work required</HELPTEXT>
      </FIELD>
      <FIELD name="Description" refname="System.Description" type="PlainText">
        <HELPTEXT>Potential cause of divergence from plan, its impact on business goals, and steps taken to mitigate the risk</HELPTEXT>
      </FIELD>
      <FIELD name="Blocked" refname="Microsoft.VSTS.CMMI.Blocked" type="String" reportable="dimension">
        <ALLOWEDVALUES expanditems="true">
          <LISTITEM value="Yes" />
          <LISTITEM value="No" />
        </ALLOWEDVALUES>
        <DEFAULT from="value" value="No" />
      </FIELD>
      <FIELD name="History" refname="System.History" type="History">
        <HELPTEXT>Discussion thread and other historical information</HELPTEXT>
      </FIELD>
      <FIELD name="Mitigation Triggers" refname="Microsoft.VSTS.CMMI.MitigationTriggers" type="HTML">
        <HELPTEXT>The mitigation triggers</HELPTEXT>
      </FIELD>
      <FIELD name="Mitigation Plan" refname="Microsoft.VSTS.CMMI.MitigationPlan" type="HTML" />
      <FIELD name="Related Link Count" refname="System.RelatedLinkCount" type="Integer" />
      <FIELD name="Contingency Plan" refname="Microsoft.VSTS.CMMI.ContingencyPlan" type="HTML" />
      <FIELD name="Probability" refname="Microsoft.VSTS.CMMI.Probability" type="Integer" reportable="dimension">
        <HELPTEXT>A percentage indicating the estimated likelihood that the risk will occur</HELPTEXT>
        <REQUIRED />
      </FIELD>
      <FIELD name="Impact" refname="Konamiman.TFS.Impact" type="Integer" reportable="dimension">
        <HELPTEXT>Impact of the risk on the project planning. Higher values mean higher loss.</HELPTEXT>
        <REQUIRED />
      </FIELD>
      <FIELD name="Exposure" refname="Konamiman.TFS.Exposure" type="Integer">
        <HELPTEXT>Exposure of the risk, calculated as probability by impact.</HELPTEXT>
      </FIELD>
      <FIELD name="Iteration Path" refname="System.IterationPath" type="TreePath" reportable="dimension">
        <HELPTEXT>The iteration of the product with which this risk is associated</HELPTEXT>
      </FIELD>
      <FIELD name="IterationID" refname="System.IterationId" type="Integer" />
      <FIELD name="External Link Count" refname="System.ExternalLinkCount" type="Integer" />
      <FIELD name="Team Project" refname="System.TeamProject" type="String" reportable="dimension" />
      <FIELD name="Hyperlink Count" refname="System.HyperLinkCount" type="Integer" />
      <FIELD name="Attached File Count" refname="System.AttachedFileCount" type="Integer" />
      <FIELD name="Node Name" refname="System.NodeName" type="String" />
      <FIELD name="Area Path" refname="System.AreaPath" type="TreePath" reportable="dimension">
        <HELPTEXT>The area of the product with which this risk is associated</HELPTEXT>
      </FIELD>
      <FIELD name="Revised Date" refname="System.RevisedDate" type="DateTime" reportable="detail" />
      <FIELD name="Changed Date" refname="System.ChangedDate" type="DateTime" reportable="dimension" />
      <FIELD name="ID" refname="System.Id" type="Integer" reportable="dimension" />
      <FIELD name="AreaID" refname="System.AreaId" type="Integer" />
      <FIELD name="Authorized As" refname="System.AuthorizedAs" type="String" syncnamechanges="true" />
    </FIELDS>
    <WORKFLOW>
      <STATES>
        <STATE value="Proposed">
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
          </FIELDS>
        </STATE>
        <STATE value="Active">
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedReason">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
              <REQUIRED />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
              <ALLOWEXISTINGVALUE />
              <REQUIRED />
            </FIELD>
            <FIELD refname="System.AssignedTo">
              <ALLOWEXISTINGVALUE />
              <REQUIRED />
            </FIELD>
          </FIELDS>
        </STATE>
        <STATE value="Resolved">
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <EMPTY />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedReason">
              <COPY from="field" field="System.Reason" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedDate">
              <REQUIRED />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedBy">
              <ALLOWEXISTINGVALUE />
              <REQUIRED />
            </FIELD>
            <FIELD refname="System.AssignedTo">
              <ALLOWEXISTINGVALUE />
              <REQUIRED />
            </FIELD>
          </FIELDS>
        </STATE>
        <STATE value="Closed">
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <REQUIRED />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <REQUIRED />
            </FIELD>
          </FIELDS>
        </STATE>
      </STATES>
      <TRANSITIONS>
        <TRANSITION from="" to="Proposed">
          <REASONS>
            <DEFAULTREASON value="New" />
          </REASONS>
          <FIELDS>
            <FIELD refname="System.AssignedTo">
              <DEFAULT from="currentuser" />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Proposed" to="Active">
          <REASONS>
            <DEFAULTREASON value="Mitigation Triggered" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Active" to="Resolved">
          <REASONS>
            <DEFAULTREASON value="Mitigation Action Complete" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ResolvedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Active" to="Closed">
          <REASONS>
            <DEFAULTREASON value="Overtaken by events" />
            <REASON value="Rejected" />
            <REASON value="Eliminated" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Resolved" to="Active">
          <REASONS>
            <DEFAULTREASON value="Mitigation Action Unsatisfactory (rework)" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Resolved" to="Closed">
          <REASONS>
            <DEFAULTREASON value="Mitigated" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Proposed" to="Closed">
          <REASONS>
            <DEFAULTREASON value="Rejected" />
            <REASON value="Accepted (won't mitigate)" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
              <REQUIRED />
            </FIELD>
          </FIELDS>
        </TRANSITION>
        <TRANSITION from="Closed" to="Active">
          <REASONS>
            <DEFAULTREASON value="Closed in error" />
          </REASONS>
          <FIELDS>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
              <ALLOWEXISTINGVALUE />
              <COPY from="currentuser" />
              <VALIDUSER />
            </FIELD>
            <FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
              <SERVERDEFAULT from="clock" />
            </FIELD>
            <FIELD refname="System.AssignedTo">
              <COPY from="field" field="Microsoft.VSTS.Common.ClosedBy" />
            </FIELD>
          </FIELDS>
        </TRANSITION>
      </TRANSITIONS>
    </WORKFLOW>
    <FORM>
      <Layout>
        <Group>
          <Column PercentWidth="70">
            <Control FieldName="System.Title" Type="FieldControl" Label="&amp;Title:" LabelPosition="Left" />
          </Column>
          <Column PercentWidth="30" />
        </Group>
        <Group>
          <Column PercentWidth="50">
            <Group Label="Status">
              <Column PercentWidth="50">
                <Control FieldName="System.AssignedTo" Type="FieldControl" Label="Assi&amp;gned To:" LabelPosition="Left" />
                <Control FieldName="System.State" Type="FieldControl" Label="&amp;State:" LabelPosition="Left" />
                <Control FieldName="System.Reason" Type="FieldControl" Label="&amp;Reason:" LabelPosition="Left" />
              </Column>
            </Group>
          </Column>
          <Column PercentWidth="50">
            <Group Label="Classification">
              <Column PercentWidth="100">
                <Control FieldName="System.AreaPath" Type="WorkItemClassificationControl" Label="&amp;Area:" LabelPosition="Left" />
                <Control FieldName="System.IterationPath" Type="WorkItemClassificationControl" Label="Ite&amp;ration:" LabelPosition="Left" />
              </Column>
            </Group>
          </Column>
        </Group>
        <Group>
          <Column PercentWidth="50">
            <Group Label="Planning">
              <Column PercentWidth="20">
                <Control FieldName="Microsoft.VSTS.Common.Priority" Type="FieldControl" Label="&amp;Priority:" LabelPosition="Left" />
              </Column>
              <Column PercentWidth="20">
                <Control FieldName="Microsoft.VSTS.CMMI.Blocked" Type="FieldControl" Label="&amp;Blocked:" LabelPosition="Left" />
              </Column>
              <Column PercentWidth="20">
                <Control FieldName="Microsoft.VSTS.Scheduling.OriginalEstimate" Type="FieldControl" Label="Original &amp;Estimate For Mitigation Plan:" LabelPosition="Left" />
              </Column>
              <Column PercentWidth="40" />
            </Group>
            <Group Label="Risk attributes">
              <Column PercentWidth="25">
                <Control FieldName="Microsoft.VSTS.CMMI.Probability" Type="FieldControl" Label="&amp;Probability:" LabelPosition="Left" />
              </Column>
              <Column PercentWidth="25">
                <Control FieldName="Konamiman.TFS.Impact" Type="FieldControl" Label="Impact:" LabelPosition="Left" />
              </Column>
              <Column PercentWidth="25">
                <Control FieldName="Konamiman.TFS.Exposure" Type="ExpressionControl" Label="Exposure:" LabelPosition="Left" ReadOnly="True" Expression="[Probability]*[Impact]">
                  <CustomControlOptions />
                </Control>
              </Column>
              <Column PercentWidth="100" />
            </Group>
          </Column>
        </Group>
        <TabGroup>
          <Tab Label="Details">
            <Group>
              <Column PercentWidth="50">
                <Control FieldName="System.Description" Type="HtmlFieldControl" Label="Des&amp;cription:" LabelPosition="Top" Dock="Fill" />
              </Column>
              <Column PercentWidth="50">
                <Control FieldName="System.History" Type="WorkItemLogControl" Label="&amp;History:" LabelPosition="Top" Dock="Fill" />
              </Column>
            </Group>
          </Tab>
          <Tab Label="Mitigation">
            <Control FieldName="Microsoft.VSTS.CMMI.MitigationPlan" Type="HtmlFieldControl" Label="&amp;Plan:" LabelPosition="Top" Dock="Fill" />
            <Control FieldName="Microsoft.VSTS.CMMI.MitigationTriggers" Type="HtmlFieldControl" Label="&amp;Triggers:" LabelPosition="Top" Dock="Fill" />
          </Tab>
          <Tab Label="Contingency Plan">
            <Control FieldName="Microsoft.VSTS.CMMI.ContingencyPlan" Type="HtmlFieldControl" Label="&amp;Contingency Plan:" LabelPosition="Top" Dock="Fill" />
          </Tab>
          <Tab Label="All Links">
            <Control Type="LinksControl" LabelPosition="Top">
              <LinksControlOptions>
                <LinkColumns>
                  <LinkColumn RefName="System.ID" />
                  <LinkColumn RefName="System.WorkItemType" />
                  <LinkColumn RefName="System.Title" />
                  <LinkColumn RefName="System.AssignedTo" />
                  <LinkColumn RefName="System.State" />
                  <LinkColumn LinkAttribute="System.Links.Comment" />
                </LinkColumns>
                <WorkItemLinkFilters FilterType="includeAll" />
                <ExternalLinkFilters FilterType="includeAll" />
                <WorkItemTypeFilters FilterType="includeAll" />
              </LinksControlOptions>
            </Control>
          </Tab>
          <Tab Label="Attachments">
            <Control Type="AttachmentsControl" LabelPosition="Top" />
          </Tab>
        </TabGroup>
      </Layout>
    </FORM>
  </WORKITEMTYPE>
</witd:WITD>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

konamiman.MSX
Software Developer SunHotels
Spain Spain
Under the secret identity of a C# programmer, a freaky guy who loves MSX computers and japanese culture is hidden. Beware!

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 6 Oct 2010
Article Copyright 2010 by konamiman.MSX
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid