Recently I was working with a customer on a ‘New User Provisioning’ process where a couple of the requirements were to have the user (an IT user) create new users via the Service Manager Self-service Portal. The user would be prompted for various pieces of information pertaining to the new users – one of which would be the users ‘Manager’.
Now, this is relatively straight forward. All we need to do is when creating the request offering we create a prompt for ‘Manager’ and make this a Query Results type. Then when configuring the prompt, I can select a Combination Class (or Type Projection) as the target Class. Selecting the User (Advanced) Type Projection enables us to use the Manages relationships to query for Managers and Direct Reports. The relationships are called the same thing, but for reference, the first Manages relationship is a Direct Report and the second one is the Manager. All good stuff.
However, when testing the offering via the Self-service Portal I was getting strange results. 9 times out of 10 the User picker would return no results:
Now as we know a Type Projection is essentially a database query that joins many tables and returns all the data found in each table. In the case of the User (Advanced) Type Projection this amounts to 11 classes (or tables) in total – the User class and then ten related classes. So, if we use the User (Advance) combination class, we are returning lots of data most of which we do not need. Essentially what was happening was that the request was timing out before the data could be returned.
So what I decided to do was create my own Type Projection that had only the relationships that I needed – the two Manages relationships. What these actually are is the same relationship (System.UserManagesUser) defined twice within the type projection, and one of them (the ‘Manager’ relationship) has a SeedRole=’Target’ property set.
Once I created the Management Pack containing my new Type Projection I sealed and imported it. I then changed ‘the ‘Manager’ prompt in my request offering to use the new Type Projection, named User (Manager and Direct Reports) instead of the previous User (Advanced) type projection.
Notice this time the Type Projection only has three classes from which it will return data. Much more efficient!
Now when I attempted go through the request in the Self-service Portal the performance of the query is much improved returning the results almost instantaneously!!
I’ve posted this solution to the TechNet Gallery for your consumption – let me know if it helps.