Sample MP – Relation between classes, type projections, views and forms

Based on several requests, I created a sample MP that has a class definition with a relationship to another class, a type projection, a view that uses the type projection and a specific form for managing objects of this class. It’s indeed a very simple MP, but it should clarify the relation between those different kinds of MP elements and when to use them.

So I created a class for a new Work Item type called “Service Request”. This class only has a few properties like “ID”, “Title” and “Implementer”.  The Implementer of the Service Request is a User, means this is a relationship property to the user class. Most of the work was done by using the Service Manager Authoring Tool or direct XML editing. So you can read on even if you’re not a Visual Studio Pro :)

The end result looks something like this:

image

image

Lets take a look at the class definition first. The class specifies the properties “ID” and “Title”. The ID property is the key property and uses an auto incrementing value with the prefix “SR”. The title property is just a simple string. The class is the base for managing new Service Request objects.

image

For creating the relationship, a relationship type is created that relates the Service Request class to the System.User class. With this configuration it will be possible to add a User to a Service Request by using a user picker.

image

Next comes the Type Projection. It will be used to create a view and to target the form to manage Service Request objects. Because we only have a single relationship in the Service Request class, there is only one component. Without the Type Projection it would not be possible to display Service Request objects with all properties, because the Service Request implementer would not be selectable in the View. Also when creating a custom form, it would not be possible to put all needed controls on it – the Implementer could not be bound to a userpicker control.

image

Because the generic form does not allow the configuration of related objects (means it does not offer instance pickers), I created a very simple form for managing the Service Requests directly in the Authoring Tool. Check the form target, it’s the Type Projection I created before and that makes it possible to place a user picker on the form that is bound to the user class to select the Service Request Implementer.

image

Last but not least, let’s take a look at the view. The view is also targeted at the Type Projection, not at the class. This is because I want to be able to display Information about the implementor in the grid view. If I would choose the class as the target, I could only select direct properties of the Service Request class, but not the Service Request Implementer (User).

image

With all that together, you can display all information everywhere you need it. I hope this very simple example clarifies some things. If you take a look at the complete MP you will see that some things could be optimized, but as this is only an example, I did not invest too much time in cosmetics. But to learn, just import it in your SM Infrastructure and try to follow the configurations.

Download the MP here! Filename: itnetx.typeprojection.sample.xml.

Regards
Marcel

This entry was posted in SCSM and tagged , , , , , , , , , . Bookmark the permalink.

8 Responses to Sample MP – Relation between classes, type projections, views and forms

  1. I followed the example and created my own form with a relationship from my new type – Service Asset Type and Knowledge article. Everything works fine but when I create the view I dont get an option under display to show the related class (Knowledge Article) properties. I thought I did something wrong so I used your MP sealed and deployed and same result, no tree view that you show above allowing you to browse into the related class properties. Any ideas?

    Thanks,

    • Hey Paul

      Did you create a Type Projection (aka Combination Class) and used this to create your view? It seems that you used a Basic class …

      regards
      Marcel

      • Yes, I created the type projection exactly like your example and I even tried importing your management pack and still the same result. Interesting though I decided to install Anton Marcinco’s advanced view editor and with his custom mpb installed I am able to view the related class in the tree structure.

  2. Guido. says:

    Hi Marcel. I have an asset management pack that i downloaded from http://systemscentre.blogspot.com.ar/2010/10/microsoft-system-center-service-manager.html. The thing is, i don´t have an answer from Steve so i think may be you can help me. This MP has many classes under many management packs. I need in this case, only convert a field Asset tag in a unique field in all service manager. I mean, if I a put an Asset tag in a mobile that this asset cannot be duplicate for example in a Switch, router or server. Now if i put a asset tag in a same category for example in a router, this cannot be duplicated but if i put the same tag in a mobile the thing is different. Thanks for your help. Regards. Guido.

  3. Does your site have a contact page? I’m having problems locating it but, I’d
    like to send you an e-mail. I’ve got some ideas for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it grow over time.

  4. Dave M says:

    Hi Marcel,

    I have created a new class inherent from the manual activities class but even though the assigned to user relationship is there it is not available when creating views, is there further work that needs to be done to set up these related views. these relationships cannot be edited because they are inherent

    • Hey

      When you select the new class to create a view you can only use the properties of this specific class. If you want to include information from another class (in your case the assigned to user), you must use a Type Projection/Combination class to create your view. Give it a try, that should work.

      Cheers
      Marcel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s