So lately I have been a lot of work on Service Manager and I keep coming across interesting requirements. This topic in particular is not a difficult one, but as I did not see much information available on this on the internet, I thought it would be an interesting article to write about.
So one of my customers wanted to “Pre Populate” certain fields in their form (This is a custom class created in Service Manager, which I will talk about in my upcoming blogs) when the “Contact_Person” (of class Active Directory User) is selected. They wanted to do this to avoid typing all the information in the fields in order to save time and also ensure that they have selected the correct User.
We know that through the Active Directory Connector we pull in a lot of information from the Active Directory into the CMDB database but where is this data really visible or where does it go? Even though this information is available in the CMDB, it is directly no visible in the work item forms. However, the information can be accessed by Navigating to the Configuration Item –> Users –> and Search for your user.
A simple example is shown below through the screenshot:
In the Above screenshot, we see that this information about the user is obtained through the Active Directory User class that is pulled from the Active Directory Connector.
However, in your work item this information is not really visible. So what is the use of this or how can we really make it visible?
To begin with, as I mentioned earlier I had to create a custom class as this was the requirement of my client (I shall cover this topic in my upcoming blogs) or you can possibly extend any of the work item class based on your needs (Incident, Service Request etc.). Additionally, based on your requirements and needs you will also need to create additional properties for your class.
Considering my scenario, using the Authoring Console I have created a new “Relationship Type” – Contact_Person of the target class “Active Directory User”. (Please ignore the other properties as they are outside the scope of this blog). A screenshot of the property is shown below:
Next step is to customize the form, so we can give our own look and do the “mapping” of the extra properties created for the fields. This is done through the Authoring Console.
Below is the screenshot of the form customized. In the below form, only the Contact Person field is created as a Relationship type (Highlighted in Green). The other fields that highlighted (in Red) in the screenshot below do not have any additional properties created (in the Authoring Console). I am going to map the properties for these extra labels (Please note that we are only concerned with the Department, EmployeeID, Division, Location and Contact No.) using the existing properties that come along with the Active Directory User Class in Service Manager.
Please note that, in order to get information from the Active Directory, it is NOT REQUIRED to create Extra Properties as we will pull these properties from the User Class that is present in Service Manager CMDB.
So once I define all the labels I need for my form, I need to edit the binds for the ones highlighted in Red. I can do the mapping for these text boxes fields. Using the Authoring tool we right click on each text box (for the fields we are interested in which are Department, EmployeeID, Divison, Location and Contact No.) and Edit Bindings for these. Below is a screenshot showing you example for Department.
This will bring up the Details Tab. Look out for the field that says “Binding Path”. Click on the Browse button.
This will bring up all the properties, which are related to your custom class (or even your extended class) including the ones that are part of your default Work Item Class (In my case it is the Service Request).
Now we want to pull the information of the user, to automatically populate the other details of the user once the “Contact Person” is selected. We go and look for our property “Contact_Person” in the bindings.
Now, through the Active Directory Connector and the User Class all the information for this available. Expand the Property “Contact_Person” and you shall see all the Active Directory related properties associated to that object of the Class Active Directory User.
Now the value that is of Interest to us in this example is the “Department”.
So we are going to select that property and Click OK. Once we are done with that you should the binding path as “Contact_Person.Department”.
The same approach needs to be taken for the other properties which are EmployeeID, Division, Location, and Contact No.
So the final bindings will be Contact_Person.EmployeeID (Active Directory property is EmployeeID), Contact_Person.Department (For Division we have used Active Directory Property Department), Contact_Person.Country (For Location we have used the property Country), Contact_Person.Mobile (Active Directory Property is Mobile).
Next, you need to save, seal and import your Management Pack. Once it is imported in SCSM, when you open the form and enter the User Name for the person in the Contact Person field, the remaining other fields will automatically populate showing the information of the user. This will save time for the person who is creating the ticket and also ensure that the correct person is selected in the form.
Hope it Helps !!
Please feel free to comment below.