How to connect OTRS with ServiceNOW

Robert Ullrich16. Aug 2017 | ConsultingMiscellaneousUse cases

With the OTRS Business Solution5s, you have the possibility to connect OTRS with ServiceNow. The following article will explain how to configure the SNOWConnector to establish a connection between OTRS and ServiceNow.

To complete this Howto, you need a running OTRS & a valid ServiceNow-System. Furthermore, you need a valid agent login. The REST/JSON API of ServiceNow is activated by default. Additionally, you have to specify a user, which is allowed to use the REST/JSON API of ServiceNow.

OTRS Requirements for this HowTo:

OTRS Framework

  • at least OTRS 5.0.x

OTRS Packages

You need the following Freely selectable Features of the OTRS Business Solution5s :

  • OTRSGenericInterfaceInvokerTicket
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
  • OTRSGenericInterfaceInvokerEventFilter
(Contains additional functionalities to add conditions to events of invokers.)

Third Party Software

You need this third party software:

  • XML::Simple
  • XML::LibXML
  • XML::LibXSLT

DynamicFields

  • “SNOWTicketNumber” of type „TEXT“ to store the ServiceNow TicketNumber (e.g.: INC0010017)
  • “SNOWSysID” of type “TEXT” to store the ServiceNow SysID (e.g.: 33d23ade0f20030010694d9ce1050ebb)
  • “SNOWLastUpdate” of type “TEXT” to store the timestamp of the last contact to ServiceNow
  • “SNOWState” of type “TEXT” to store the latest ticket state of the ServiceNow ticket

Configuring the SNOWConnector in OTRS

After you satisfied the pre-requirements, you’re ready to create a new web service within OTRS. The name of the new web service is SNOWConnector. Afterwards, you have to set up the needed providers and invokers.

SNOWConnector General Configuration

Configuring the Provider “TicketCreate”

We start with the configuration of our first Provider “TicketCreate”. ServiceNow should be able to create tickets in OTRS, if necessary.

Because ServiceNow is able to specify the data and also the format, which is sent out, we don’t need an incoming mapping.

Configuring the Provider “TicketUpdate”

It should also be possible for ServiceNow to update tickets in OTRS. For that reason, you have to configure a second provider which is called “TicketUpdate”.

We also don’t need an incoming mapping.

Configuring the Invoker “CreateIncident”

Now you’re ready to start the configuration of our Invokers. To be able to create tickets in ServiceNow, you have to set up an Invoker called “CreateIncident”.  Select all the needed data for your outgoing requests and use “XSLT” as mapping for your outgoing and incoming response data.

SNOWConnector CreateIssue InvokerConfig Pt1

For the incoming response data, you have to select the dynamic fields (SNOWTicketNumber, SNOWSysID & SNOWState), which you created before.

SNOWConnector CreateIssueInvokerConfig Pt2

Now you can configure your outgoing XSLT-mapping. If you need a working XSLT-mapping, you can use the following example:

SNOWConnector CreateIssue Outgoing Mapping

You also need a XSLT-mapping for the incoming response data, because you have to store the ServiceNow TicketNumber and the ServiceNow SysID:

SNOWConnector CreateIssue Incoming Mapping

OTRS stores the ServiceNow TicketNumber in the dynamic field “SNOWTicketNumber”. Afterward, it’s shown in the OTRS TicketZoom.

For some use cases (updating a ServiceNow ticket, upload an attachment to a ticket), you have to use the SysID of the ServiceNow ticket. For that reason, we store the SysID in the DynamicField “SNOWSysID”. Furthermore, we want to know the latest State of the ServiceNow ticket, for that reason, we’re using the <xsl:choose> element to convert the StateID into a readable format.

The used “Event trigger” is the last point for this invoker. Just select one and you’re done with the first Invoker.

Configuring the Invoker “UpdateIncident”

The next invoker is “UpdateIncident”.  Select all the needed data for your outgoing requests (please don’t forget the dynamic field “SNOWSysID” in the “Ticket dynamic fields” dropdown) and use “XSLT” as a mapping for your outgoing data.

SNOWConnector UpdateIncident Invoker Config Pt1SNOWConnector UpdateIncident Invoker Config Pt2

As outgoing XSLT-mapping, you can use my example. I will transmit the content of an article and add this content as a comment to the ServiceNow ticket.

SNOWConnector UpdateIncident Outgoing Mapping

A mapping for the incoming response data is necessary if you want to store the “LastUpdate” timestamp of ServiceNow.

SNOWConnector UpdateIncident Incoming Mapping

The used “Event Trigger” is the last point for this Invoker. Just select one and you’re done with the second Invoker. In my example I’m using an ArticleCreate event in OTRS, to trigger the Invoker.

SNOWConnector UpdateIncident Invoker Config Pt2

Configuring the Invoker “CreateAttachment”

The next invoker is “CreateAttachment”.  Select all the needed data for your outgoing requests (please don’t forget the dynamic field “SNOWSysID” in the “Ticket dynamic fields” dropdown) and use “XSLT” as a mapping for your outgoing data.

SNOWConnector CreateAttachment Invoker Config 1SNOWConnector CreateAttachment Invoker Config 2

Please use my example as outgoing XSLT-mapping:

SNOWConnector CreateAttachment Outgoing Mapping

Furthermore, a mapping for the incoming response data is necessary, if you want to store the “LastUpdate” timestamp of ServiceNow.

SNOWConnector UpdateIncident Incoming Mapping

The used “Event trigger” is the last point. Select one and you’re done with the last Invoker. In my example I’m using an ArticleCreate event in OTRS, to trigger the Invoker.

SNOWConnector CreateAttachment Invoker Trigger

Configuring the SNOWConnector “Network Transport”

Provider configuration

We have to set up the “Route mapping” and the “Valid request methods” for the provided Operations.

SNOWConnector Provider TransportConfig

Make sure you use unique “route mappings” and/or “request methods” for all operations.

Requester configuration

It’s necessary to configure the network transport for the Invokers because we’ve to use the right requests commands towards ServiceNow. But it’s quite easy as you can see:

SNOWConnector Invoker Transport Config

It’s important to use “BasicAuth” as an authentication module. Please use a valid ServiceNow user for authentication! Keep in mind, this user must be authorized to use the ServiceNow API!

Be careful with the controller mapping for “CreateAttachment”. It’s /ecc_queue instead of /incident

Afterward just click on “Save and finish”.

Testing the SNOWConnector

Testing the Providers

Finally, we can do some tests. At first, we create a ticket in OTRS from ServiceNow.

SNOWConnector TicketCreate Debugger

Now we test the second Provider “TicketUpdate”. Here’s the debug log for a ticket update from ServiceNow:

SNOWConnector TicketUpdate Debugger

 

Testing the Requester

Create or take an already existing ticket and trigger the “CreateIncident” Invoker.

As result you should see something similar in the OTRS Debugger:

SNOWConnector CreateIncident OTRS DebuggerSNOWConnector CreateIncident OTRS Debugger

In ServiceNow you now see this Incident:

SNOWConnector CreateIncident SNOW

If we now trigger the Invoker “UpdateIncident” we’ll see the following in the Debugger:

SNOWConnector UpdateIncident OTRS DebuggerSNOWConnector UpdateIncident OTRS Debugger 1

ServiceNow adds a new comment to the ticket. The comment is visible in the comment section:

SNOWConnector UpdateIncident SNOW

And the last the Invoker “CreateAttachment”:

SNOWConnector CreateAttachment OTRS DebuggerSNOWConnector CreateAttachment OTRS Debugger

You can now see the ServiceNow ticket state & last update time in OTRS.

SNOWConnector CreateAttachment OTRS

In ServiceNow, you see the attachment in the activity stream.

SNOWConnector CreateAttachment SNOW

More information about the ServiceNow API

You can also use other resources which are provided by the ServiceNow API.

If you need more information about the ServiceNow API, please go to the following website: https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=server

Your email address will not be published. Required fields are marked *

This site uses cookies. By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close