People sometimes ask why they can’t include some columns in the views that they want. Here is a common one: Why can’t I add the affected configuration item(s) as a column in my incident view?
In order to understand the answer to this question we must understand the incident data model. An “incident” record is really comprised of the following things:
See this blog post for more information on using type projections in views.
If you want to display properties of the incident object itself, that is pretty straightforward. The columns would simply just display the values of the properties. For example:
It’s also pretty straightforward to add columns for related objects where the relationship type max cardinality is 1. For example, let’s say we wanted to show the Affected User’s domain and user name.
We run into some problems when we want to display properties of objects where the relationship type max cardinality is more than 1 though. For example, let’s say we wanted to display the affected configuration items’ display names. If there was only one related configuration item we could simply just display it like this
But what do we do when there is more than one affected configuration item?
We could do something like this:
But that is kind of hard to read. It’s also technically challenging given the way the grid data binding works. This also makes it kind of hard to sort or group by the affected CI Display name column. And it would slow down performance.
This approach is also hard to read and doesn’t use space efficiently on the grid and would get really unusable when there were potentially tens or hundreds of related items.
So, at least for now, you can only use properties of objects that are related by relationship types with max cardinality = 1 as columns in views. That is why you see the Affected User, Assigned To User, etc. relationships in the view creation dialog and not Affected CI.
A few other notes on this… You can see above that the Primary Owner relationship is not included in the list even though it is a max cardinality = 1 relationship type. That’s because this view is targeted at a type projection which only includes those two relationship types. If I wanted to include the Primary Owner column in a view I would need to target the view at a type projection which includes that relationship type. For example if I target the view at the ‘Incident (advanced)’ type projection (Warning!!) then I will see lots of other relationship types available to me (but they are still all only max cardinality = 1 relationship types!):
Max Cardinality > 1 relationship types can still be used in the criteria part of the view definition though – as long as the relationship type is included in the type projection. For example:
Notice how max cardinality > 1 relationship types like ‘Is Related to Configuration Item’ and ‘About Configuration Item’ are included here so you can use them as criteria for the view.
So – how do you know if a relationship type is max cardinality = 1 or > 1? The easiest way is just to look at the fields on the form that are used for those relationships. For example – assigned to user, affected user, primary owner, etc. all use the user picker which only allows for the selection of a single user:
So – this is a max cardinality = 1 relationship type.
Other relationship types use a list view control like this:
Since you can have more than one item here this is a max cardinality > 1 relationship type.
Since an action log can have multiple entries in it this is also a max cardinality > 1 relationship type:
Hope that helps make it more clear why you can’t add some of the columns you might want.
I think I understand this, but theres two factors that keep popping up from my user group.
1. The "affected User Display Name" and "Assigned to user Display Name" that you mention above, both show as "Display Name". Is the cardinality somehow preventing these names from being identified uniquely?
2. There are some views that are completely locked (as far as I know anyway) such as the "advanced find" view which I've had quite a few requests to have far more columns available. Is there a way of expanding some basic control of the views that are displayed, even better if it can be controlled by the person doing the search without them being an admin?
2. No, sorry
I would like to add a display column for the Affected User-User Name for a service request view. This is for Service Manager 2012. I don't see that column available to display. Is there a way to do this? Thanks.
it looks like the data model for service manager needs a revision, i cannot see how it make sense - not being able to display "primary owner" in these views. We also want to include whether the item has attachments (without open the incident, and check the "related items" tab).
Thanks for any useful information.