Chat now with support
Chat with Support

Identity Manager 9.2.1 - Administration Guide for Connecting to ServiceNow

ServiceNow Module Overview Installation Managing ServiceNow Incidents from One Identity Manager One Identity Manager for Service Catalog Logging Troubleshooting

Use Case Scenario with One Identity Manager as Master

In this use case scenario, a ticket is created on ServiceNow for any item that is requested on the One Identity Manager Web Portal with One Identity Manager as the master.

This scenario uses the following steps:

Step 1: Enable Service category: To enable the functionality of creating a ServiceNow ticket for a service item, you must first enable the service category for ServiceNow.

Step 2: Create service request ticket: The SCN_Create ServiceNow ticket process creates a ticket on ServiceNow, based on the parameters configured in the process task. After a ticket is created, it must be resolved on ServiceNow, as ServiceNow is the master.

Step 3: Check ticket status: Once a ticket is created, it must go through the regular approval processes that is configured to the shelf containing the item. The SCN_Update 1IM status to ServiceNow process is triggered if any change is made on the status of the request. This process ensures that the JSON response is sent to the ServiceNow end, and the associated ticket is updated in ServiceNow.

NOTE: If the SCN_Update 1IM status to ServiceNow process fails, it is recommended to create a new MailComponent process step that enables you to send a mail alert to the requester.

In case of an error, when the ticket is not created for a request , the request goes into denied state and then, the user is allowed to request for the same product again.

Customizing ServiceNow module

Customizing the ServiceNow module involves the following steps:

Creating ServiceNow Ticket – Adding more attributes to the ticket creation

The ServiceNow component CreateTicket enables you to create tickets.

To create tickets

  1. In the Designer, navigate to Process Orchestration | Process ComponentsSCNComponent | CreateTicket.

  2. To create a parameter for the CreateTicket task, right-click CreateTicket, and select New parameter.

    The Parameters properties dialog is displayed.

    1. In the Name field, enter a name that matches the ServiceNow parameter name. This new parameter must match the ServiceNow parameter. For example, if you want to add the ServiceNow parameter resolved_by, provide the name for the new One Identity Manager parameter as resolved_by.
    2. In the Value template field, enter the value template with the syntax: Value = <Value to be configured>. For example, Value = "test".

A process step with the CreateTicket task sends the configured values to ServiceNow to create a ticket. The Create ServiceNow Ticket uses this process step to create a ticket.

Manipulating the response from ServiceNow

The process step with GetTicketStatus task gets the status of a ticket.

The SCN_Create ServiceNow Ticket process enables to create a ticket in ServiceNow and update the field ServiceNowSystemID of the PersonWantsOrg table. This field is used in the SCN_Check_status_of_the_ServiceNow_ticket process, which is called over time. This process chain contains a process step using the GetTicketStatus task which uses the ServiceNowSystemID as a reference to the ServiceNow and returns the status in the field SNOW Response.

SNOW Response value is a JSON response which is then parsed to get any desired field of the ServiceNow response schema. These fields can later be leveraged to change the status of the associated PersonWantsOrg entry accordingly.

This SNOW Response value is used in the script SCN_UpdatingOneIMTicketStatus. This is first parsed to a NewtonSoft Object type and then values are taken out using the SelectToken function. Further explanation is given below.

The response value script is represented below:

#If Not SCRIPTDEBUGGER
References Newtonsoft.Json.dll
#End If
'This script is used for updating the status from the ServiceNow ticket to the corresponding PersonWantsOrg entry in One Identity Manager.
'Dieses Skript wird zum Aktualisieren des Status vom ServiceNow-Ticket zum entsprechenden PersonWantsOrg-Eintrag in One Identity Manager verwendet.
Public Overridable Function SCN_UpdatingOneIMTicketStatus( ByVal statusResultsData As String , ByVal UID_PWO As String) As Boolean
Dim PWO As ISingleDbObject = Connection.CreateSingle("PersonWantsOrg", UID_PWO)
Dim snowResponse As Newtonsoft.Json.Linq.JObject = Nothing
Try
snowResponse = Newtonsoft.Json.Linq.JObject.Parse(statusResultsData)
'We can retrieve any value from the ServiceNow Response JSON.
'In this script, we are getting the values for "sys_id", "number", "state", etc.
'A detailed sample of a JSON response can be found in the One Identity Manager Administration Guide.
'Wir können jeden Wert aus dem ServiceNow-Antwort-JSON abrufen.
'In diesem Skript erhalten wir die Werte für "sys_id", "number", "state" usw.
'Ein detailliertes Beispiel einer JSON-Antwort finden Sie im OneIM-Administrationshandbuch.
'Syntax to get a value from the json : snowResponse.SelectToken("<variable name>").ToString()
'Syntax, um einen Wert aus dem json: snowResponse.SelectToken ("<Variablenname>") . ToString ()
 
'Example : snowResponse.SelectToken("sys_id").ToString()
'Beispiel: snowResponse.SelectToken ("sys_id"). ToString ()
 
'Any internal fields or nested fields can be queried in the format:
'Alle internen Felder oder verschachtelten Felder können im folgenden Format abgefragt werden:
'snowResponse.SelectToken("<parent1 variable name>").SelectToken("<Parent2 Or internal field name>")....ToString()
'Example:" snowResponse.SelectToken("resolved_by").SelectToken("link").ToString()
'Beispiel: "snowResponse.SelectToken (" resolved_by "). SelectToken (" link "). ToString ()
 
Dim sysID As String = snowResponse.SelectToken("sys_id").ToString()
Dim incnumber As String = snowResponse.SelectToken("number").ToString()
Dim status As String = snowResponse.SelectToken("state").ToString()
Dim ownerID As String = snowResponse.SelectToken("sys_updated_by").ToString()
Dim close_code As String = snowResponse.SelectToken("close_code").ToString()
Dim close_notes As String = snowResponse.SelectToken("close_notes").ToString()
Dim resolved_at As String = snowResponse.SelectToken("resolved_at").ToString()
 
'The value for the status variable should be modified to the value as configured at the ServiceNow End
'Der Wert für die Statusvariable sollte auf den Wert geändert werden, der im ServiceNow-Ende konfiguriert wurde
 
If status = "6" Then
'On the basis of the state, we can make the necessary decision on the PersonWantsOrg entry.
'Auf der Grundlage des Staates können wir die notwendige Entscheidung über den Eintrag PersonWantsOrg treffen.
'Deutsche Übersetzung des folgenden Anrufs
'Beispiel: PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket 123 wurde erfolgreich vom Benutzer admin geschlossen")
 
PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket#" + incnumber + " was closed successfully by " + ownerID + " " + sysID +"")
PWO.PutValue("SNOWExt",True)
PWO.Save()
End If
Return True
Catch ex As Exception
Return False
End Try
End Function
 

Based on the configuration of values in the ServiceNow end, the value of the order state can be changed. For instance,

If status = "6" Then
'On the basis of the state, we can make the necessary decision on the PersonWantsOrg entry.
'Auf der Grundlage des Staates können wir die notwendige Entscheidung über den Eintrag PersonWantsOrg treffen.
'Deutsche Übersetzung des folgenden Anrufs
'Beispiel: PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket 123 wurde erfolgreich vom Benutzer admin geschlossen")
 
PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket#" + incnumber + " was closed successfully by " + ownerID + " " + sysID +"")
PWO.PutValue("SNOWExt",True)
PWO.Save()
End If

Here, a ServiceNow instance has the state “6” configured as close and assigned in ServiceNow. Hence, the custom call PWO.Custom.CallMethod(“MakeDecision”,””, True,”Message”) is set to true.

If a request is denied from the ServiceNow, then the custom call changes to PWO.Custom.CallMethod(“MakeDecision”,””, True,”Message”) is set to false.

Please ensure that the statement PWO.PutValue(“SNOWExt”,True) is present, after any decision making step as its value is used in other processes.

The SnowResponse can be used to retrieve any field of the ServiceNow response. These retrieved values can be used to set the variables of a ticket. For example,

If status = "6" Then
'On the basis of the state, we can make the necessary decision on the PersonWantsOrg entry.
'Auf der Grundlage des Staates können wir die notwendige Entscheidung über den Eintrag PersonWantsOrg treffen.
'Deutsche Übersetzung des folgenden Anrufs
'Beispiel: PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket 123 wurde erfolgreich vom Benutzer admin geschlossen")
 
PWO.Custom.CallMethod("MakeDecision", "", True, "Ticket#" + incnumber + " was closed successfully by " + ownerID + " " + sysID +"")
PWO.PutValue("SNOWExt",True)
PWO.Save()
End If
 

In this script, the message portion of the custom call is configurable. We have configured the message to display some text and values of the field “sys_udpated_by” and “sys_id”. These values are retrieved before this If block as shown below:

Dim sysID As String = snowResponse.SelectToken("sys_id").ToString()

Dim ownerID As String = snowResponse.SelectToken("sys_updated_by").ToString()

Similarly more values can be retrieved with the syntax,

  • Dim testPropName As type = snowResponse.SelectToken(“ServiceNow field name”).ToString()

For internal child fields,

  • Dim testPropName As type = snowResponse.SelectToken(“ServiceNow parent name”).SelectToken(child1)….ToString()

These retrieved values can also be used to set some field of PersonWantsOrg entry like ReasonHead for instance.

General Syntax: PWO.PutValue(“<PersonWantsOrg field name>”,testPropName)

Example:

  • Dim closenotes As String = snowResponse.SelectToken(“close_notes”)
  • PWO.PutValue(“ReasonHead”, closenotes )

NOTE:

  • PWO.PutValue is only applicable after the initialization in the script.
  • Script SCN_UpdatingOneIMTicketStatus cannot be modified directly. If further customizations are required on this script, new custom scripts must be created by copying this script’s content and changes must be done on the new script. Change the function’s name and use the same custom script name in the process step. The process chain referencing this script is SCN_Check status of the ServiceNow ticket. Modify the script name in the following internal process step: Updating the One Identity Manager with status of resolved tickets.
Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating