How to Sync Time-related Information between ServiceNow and Jira

time-related info between Jira and ServiceNow

This question has been raised on ServiceNow community

This page details the answer to this question.

1. Question

We have the following workflow:

  • An incident is raised on ServiceNow.
  • This incident escalates towards Jira where an Epic is created.
  • The Epic is broken down into stories. Every story has a time estimate and the actual time spent information.

The question is:

Is it possible to synchronize this time-related information back to the incident, so that we can keep track of the budget consumed by the development activities?

2. Answer

2.1. Overview

This use case is an advanced synchronization case and needs quite some explanation. The overall flow is as follows:

  • The incident is escalated to Jira using an Exalate Trigger.
  • The Exalate on Jira creates an epic.
  • This epic is broken down into stories.
  • Whenever a story is created and/ or modified, sync is triggered on the parent epic.
  • During the sync from the Epic to the incident, the time tracking-related information is tallied and included in the message to the incident.
  • This information is included in custom fields on the incident.

2.2. The details

2.2.1. The incident is escalated to Jira

In Exalate for ServiceNow, you can define a trigger – which will regularly check (every 20 secs) if an incident should be synchronized.

In this case, an additional state has been added, such that the user has an easy way to send over the incident.

The incident gets wrapped into a message, and the message is sent over to Jira.

2.2.2. The Exalate on Jira creates an epic

The Exalate for Jira Server receives the message, finds out if this is the first time this incident is being synced, and processes the following code:

Exalate Jira sync rules

This will

  • Create the epic.
  • fill in the epic name custom field (which happens to be mandatory for Epics).
  • Create a synchronization relationship between the incident and the epic.

A link is also added to the incident.

ServiceNow incident sync

2.2.3. This epic is broken down into stories

This is something that the development team does and results in a detailed ‘mini-project-plan’.

Sync time info between Jira and ServiceNow

2.2.4. Whenever a story is created and/ or modified, sync is triggered on the parent epic

Using a ‘script listener’, update events on stories which are escalated into the sync of the epic.

Sync epics

2.2.5. During the sync from the Epic to the incident, the time tracking related information is tallied and included in the message to the incident

Whenever an epic is synced, all the relevant information is collected from the underlying stories (and optionally subtasks), using the following code

  • Line 18 is calling an externalized script which contains the logic to tally all relevant information.
  • Line 19 – Line 21 include this information into the message sent to Exalate for ServiceNow.

2.2.6. This information is included in custom fields on the incident

The code to update the ServiceNow incident is:

Sync time related info

The prettyPrint method is a custom method (included in the script) which transforms the duration into a pretty print format (expressing time in days/hours/minutes).

2.3. Getting access

The whole configuration is available and can be requested through our support channel.

Recommended Reading:

Comments are closed.