This scenario came through my inbox recently, and what looked like a fairly straight forward runbook turned out to have a couple of gotcha’s in it.
The scenario requested was to pick up the affected user of a Change Request, and make them part of the approval process. In Service Manager, this means making them a reviewer in a Review Activity inside a Change Request.
So the basic process looks like this:
- Monitor for a Change Request (CR)
- Take a look at the CR and compile a list of all associated users
- Filter this list down to the user who is affected by this CR (as opposed to other users such as the person who raised the CR)
- Look inside the CR and find the appropriate Review Activity
- Add the affected user into the Review Activity as a reviewer
In Opalis, this runbook looks like this (this is actually what I created to solve the request).
There are 2 steps that needed a little thought, and I’ll explain them as we go through the activities in this runbook.
This activity would normally be a Monitor Object, but for simplicity and testing I just looked up a known CR.
Get Related Users
Now that we have all the CR information on the Opalis Databus, we can use the Get Relationship activity to find out all the associated users.
Filter on the Link – Extra thought number 1
Because we get back several users and of different relationships to the CR, we need to filter down to the one we want. The other users, like the person who raised the CR have different relationship types. If we have multiple users, we would need to filter further but this is sufficient for this example.
Now that we have our user, we can do a Get Object on this user to add all their information onto the Databus so we can link it later.
Get Review Activity
We need to look inside the CR and find the Review Activity for the approval. Again, we only have one and we would filter this further if we got multiple RA’s back.
Create Reviewer Item – Extra thought number 2
This stopped me for a few minutes. When I tried to create the relationship activity, I could not see how to link a user to a review activity. A quick test through the Testing Console revealed that the published data that came back from the Get Review Activity did not include any user account information. A tell-tale sign that inside Service Manager, the user is not an attribute of the RA. Indeed, the Reviewers are actually related objects to the Review Activity. So we just need 1 extra step which is to Create a Related Object.
Assign Review Item to User
And now, we can link our user to that newly created Reviewer object, and we’re done!
Now an obvious question is, what about if I had multiple RA’s and you wanted to add the user to a specific one. No problem. You would simply to a Get Relationship on the Review Activity looking for Reviewer related objects, and you would get back the RA’s, and you could filter this down to the one you want.
I hope this is useful!