Another time when some XML editing comes in handy is when you're trying to create some more customized views. Sure, you're able to create views from the console, but the Create View dialogue doesn't allow you to do things such as renaming column headers, set the order of columns, or something as simple as creating a view criteria that includes the same property twice, constructed with an AND instead of OR.
In this recipe, we will do just that - modify the view criteria through some XML editing so it is constructed with an AND instead of an OR.
In order to follow this recipe you will need to create a view from the console for us to edit in XML:
So we have our view that we need to edit in order to work, this is how you would fix the criteria:
DisplayStrings
section of the management pack, which should look similar to this:<DisplayString ElementID="View.baa0288a02d149b4a2f8e5124dc4e247"> <Name>All Active Incidents</Name> </DisplayString>
View.baa0288a02d149b4a2f8e5124dc4e247
) and do a search for this until you find a row starting with <View ID= When you've located that row, you've found the actual view definition of the All Active Incidents view.<Criteria>
tag. This is where the view criteria is defined.<Expression>
tags, but there should also be a tag called <Or>
and another one called </Or>
. The code between these two tags are the code that defines that the Status Should Not Equal Resolved or Status Should Not Equal Closed.
In order for our changes to apply, you might need to restart your Service Manager console since the view might be cached.
After you've made the change in the management pack by editing the XML and re-imported it into Service Manager, the view criteria should now contain an AND instead of an OR.
To see how our changes are reflected in the console, locate the All Active Incidents view, right-click it, and then select Edit View. Now if you go to the Criteria section of this view, there should now be an AND instead of the OR, but what is also worth noting, is that the criteria section is now disabled. This is because we've edited the criteria directly in the management pack and that the Edit View wizard doesn't support the modification.
There are plenty of other modifications that you can do to views by doing some XML editing - as mentioned earlier changing column names and order is two of them. You might also change things such as column width, how sorting should be handle in different columns, the view icons, and so on.