Partager via


Selecting the Days of the Week in a Service Request

A requirement recently came up where during the new user creation process it was needed to indicate what days of the week the user would be working. As we can’t multi select with a date time input, free text was not going to be helpful, and too many true / false values I came up with another way to record this information.

I had to create a new class within Service Manager to hold an object for each of the days of the week. This would then present as a configuration item which could be attached to the Service Request. The user creating the request would be presented with a query for the days of the week and can multi select the values. Below is how I went about this using the Service Manager Authoring tool.

Note that it was not important to store this information permanently – if I wanted to I could have stored it against the user object however the service request was appropriate for this situation.

So a new management pack – open the authoring tool and create a new management pack, what you end up with is the blank MP in the browser.

 image

Right click on classes and select Creation Configuration Item Class – give it a name (this is the internal name – not the display name).

image

In the Details pane I change the display name of the new class – so it looks pretty in the console. Close the details window so you can see the class properties. Service Manager gives us a whole heap of predefined properties – as our new class inherits from one of the base classes these are all inherited properties.

image

Down the bottom of the properties window you can delete the new property which has been helpfully inserted. Ignore the warning as they are just explaining that the class needs to have a key property. We will create a key next.

image

Click on Create Property and give it a name to represent the day of the week. Ignore the warning once again and right click on the new property and select Details. Change the display name and use the

drop down box to change the key value to True.

image

We only need one property – as a day really only has a name. At this point we can import the management pack into Service Manager and create a view. We can add each day of the week using the default Create task. What I cant do is add the object to a service request – this is because no relationship between the request and day of the week exists. To fix this I need to extend the Service Request class. In the Class Browser pane search for Service Request and right click and select view. The management pack is added to the Management Pack explorer pane. Select the service request class, right click and select Extend Class. Choose your management pack and hit OK. A new class is added to our management pack called “Extension of Service Request”. Change the display name to something that makes more sense.

image

Click on Create Relationship and give it a name. When we attach the day of the week to a service request we will be able to use a Get Relationship activity to discover this relationship.

image

Right click and select details – or press F4. In the details pane we need to edit the source and target properties. Use the ellipse to select the correct class for each part of the relationship.

image

Now we can save the management pack and import it into Service Manager.I created a new view in the management pack using the console so I can see my objects. I have a default Create Day of the Week button which I use to create an object representing each day. Here is my new view and created objects.

image

Now when I create a request offering I can use a query input – allow the user to select multiple objects and then attached the configuration items to the service request.

image

Comments

  • Anonymous
    December 10, 2014
    In the last post I showed how to “move along” users who are slacking at doing their approvals. This post