Oftentimes when you are creating a new view for Service Manager you will want to use properties of related classes in your criteria.  Examples:

  • All the incidents assigned to a anybody that is in a particular office or department
  • All the computers that have a particular software title installed on them
  • All the change requests that have an active review activity

A Type Projection is a way to define a query that goes over multiple relationship types to bring together data from multiple classes as a single object.  For example, we have the Incident class.  It defines properties like Urgency, Impact, Priority, etc.  and it has relationships to other objects like User.  In fact Incident has multiple relationships to the User class – 1) Affected User, 2) Primary Owner, 3) Assigned To to name a few.  When a help desk analyst thinks of an Incident though he thinks of the Affected User as just being another “property” of the Incident.  Type Projections allow you to bring all of this data together as a single “object” that can be represented on a form.

You can create views which are based on a showing objects of a single class or based on a type projection.  If you use just a class you can only use properties of that class as criteria or display them as columns in the view.  If you use a type projection you can use related class properties in your criteria or as columns in the view.

Here is a great blog post that Patrik Sundqvist wrote up on creating views using type projections:

http://blogs.litware.se/?p=367

I’ve also created an example MP that shows you how to create new type projections (in case we didn’t provide the one you need out of the box) and then create views based on those type projections.  In this particular example, I had a customer ask me how to create a view of computers that had a particular software title installed on it.  Since we don’t provide a type projection out of the box for this I' created one for him and then created an example view.  Once the management pack containing the type projection is imported, he can now create additional software views using slightly different criteria using the console.

This is what a type projection looks like in the management pack:

<TypeProjection ID="Microsoft.Demo.ComputersHaveSoftware.ProjectionType" Accessibility="Public" Type="Windows!Microsoft.Windows.Computer">

        <Component Path="$Context/Path[Relationship='SoftwareLibrary!System.DeviceHasSoftwareItemInstalled']$" Alias="WindowsComputerHasSoftwareItem" />

</TypeProjection>

Once it is imported into Service Manager it is available for selection in all of the places where you can select a class or type projection such as the view creation dialog:

image

Here is where you can download the management pack example:

http://cid-17faa48294add53f.skydrive.live.com/self.aspx/.Public/Microsoft.Demo.SoftwareViews.xml

For more information on type projections including how to manipulate them using the SDK please see these blog posts on Jakub’s blog:

http://blogs.msdn.com/jakuboleksy/archive/2009/01/20/getting-started-with-type-projections.aspx

http://blogs.msdn.com/jakuboleksy/archive/2009/02/04/more-with-type-projections.aspx

http://blogs.msdn.com/jakuboleksy/archive/2009/03/04/getting-and-working-with-type-projections-basic.aspx