次の方法で共有


Creating a View for the Primary Owner

I had a request recently to build a view which showed all Incidents where the primary owner was the console user. Sounded simple enough but took awhile because of the criteria.

As I use the Advanced View Editor so I can make columns look nicer I included what I did to customise the view below. I worked it out by looking at the inbuilt Assigned to Me view.

Create a new advanced view and fill in the basic details, select a management pack etc.

image

Use the Incident (Advanced) type projection. I would recommend adding the type projection management pack here so that some less intensive projections can be selected.

If I look at the XML for the Assigned to Me view it looks like the below – since I can’t select the [me] token in my new view I need to edit the XML and create something similar to the below.

<Criteria xmlns="https://Microsoft.EnterpriseManagement.Core.Criteria/">
          <Expression>
            <In>
              <GenericProperty Path="$Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser' SeedRole='Source']$">Id</GenericProperty>
              <Values>
                <Token>[me]</Token>
                <Token>[mygroups]</Token>
              </Values>
            </In>
          </Expression>
        </Criteria>

What I do is in my advanced view builder I select the Primary Owner and just add in a random field –e.g. Name. Then I switch to the XML view.

image

The XML looks like below – I just change it around a bit because to use a token (e.g. [me]) we have to use a generic property tag.

Before:

<Expression>
    <SimpleExpression>
      <ValueExpressionLeft>
        <Property>$Context/Path[Relationship='CoreIncident!System.WorkItem.IncidentPrimaryOwner' TypeConstraint='System!System.User']/Property[Type='System!System.User']/FirstName$</Property>
      </ValueExpressionLeft>
      <Operator>Equal</Operator>
      <ValueExpressionRight>
        <Value>[me]</Value>
      </ValueExpressionRight>
    </SimpleExpression>
  </Expression>

After:

<Expression>
          <SimpleExpression>
            <ValueExpressionLeft>
              <GenericProperty Path="$Context/Path[Relationship='CoreIncident!System.WorkItem.IncidentPrimaryOwner' TypeConstraint='System!System.User']$">Id</GenericProperty>
            </ValueExpressionLeft>
            <Operator>Equal</Operator>
            <ValueExpressionRight>
              <Token>[me]</Token>
            </ValueExpressionRight>
          </SimpleExpression>
        </Expression>

I create a new incident and it appears in the view.

image

Comments

  • Anonymous
    August 04, 2015
    Thank you this worked fantastically!