Read this bog post first:
In SCSM 2010 we had an Active X control that was used to look up the local computer name that the user was running the portal on. If a computer record existed for that computer it would be added to the submitted incident as an affected computer. That was good and bad. It was good because it gave the analyst working on the incident some context about what computer could be having the problem. The user didn’t necessarily need to know the name of the computer. But it was also not ideal because it required an Active X installation on the client. It also isnt necessarily always true that the computer the user is submitting an incident from is the computer that is having the problem. It also wasn’t possible to select any other computer as the affected computer.
So, in SCSM 2012 the request offering wizard makes things a little more flexible. You can use the Query Results prompt type to present the user with a list of objects to choose from (and it could be multiple). One of the more common things you will want users to provide when making a request from the service catalog is to choose a computer. Oftentimes you want this to be a computer that is related to them somehow in the CMDB – typically either through the Custodian or the Primary User relationship. The Primary User relationship is automatically populated from SCCM based on the logon history of the computer so this is a good way to determine which computers a user frequently uses. In this blog post I’ll show you how to allow the user to select from only those computers for which he is the Primary Owner.
For this example, I have created a ‘PC Recycle’ request offering.
You can see that there are only two computers shown in the list even though in my test environment I have quite a few more than that:
Those two computers show up because they are the only two for which I am the primary user:
Let’s take a look at how I configured the request offering to limit the list of computers to just those for which I am the primary user.
Here’s the General information:
Here is where I create the user prompt for the user to choose a computer. Notice it is a Query Results prompt type.
On the Configure Prompts page, I select the computer prompt and click the Configure button…
…. which brings up this dialog:
In the Select Class tab I choose ‘Combination Classes’ from the drop down because we are going to use a “type projection”. Using a type projection allows us to specify query criteria which spans over relationship types. For example – ‘all computers where the related primary user’s username = twright’.
I then chose the Computer (Advanced) combination class (aka type projection).
On the Configure Criteria tab I select the Primary User relationship on the left and then check the ‘User Name’ checkbox on the right and click the Add Constraint button.
Now, this is where the magic happens! First select ‘Equals’ from the operator drop down. Then pull down the Set Token menu and select the ‘Token: Portal User Name’ option.
The result will look like this:
The effect of this is that whatever the logged in user’s user name is for the user that is accessing the portal will be passed in at run time to this criteria. The result is that only those computer which are related to the user over the Primary User relationship will be displayed.
On the Display Columns tab I choose which columns I want to display:
On the Options tab I choose to relate the selected computer as an affected configuration item to the service request that will be submitted.
Configuring the rest of the request offering is just standard stuff so I won’t go into that here.
The result of someone submitting a service request like this is:
You could use this same approach for displaying other types of objects that are related to the user logging into the service catalog such as:
- CI custodian (this would work for any kind of CI, not just computers)
- Work items where the user is the affected user
- Work items where the user is the assigned to user
- A manager’s direct reports