How to Sync SLA Records and Maintain State Updates From ServiceNow Incident to Jira Issue

Sync SNOW Case to Jira Epic

This article was originally published in the Atlassian Community.

By integrating Jira and ServiceNow, teams can fetch related SLA records within a ServiceNow incident and sync them in a user-defined Jira issue field, enabling them to track SLA information and ensure timely incident resolution.

In this blog post, we will see how to implement this use case using an integration solution called Exalate

So let’s jump right in! 

The Use Case

The following are the use case requirements: 

  • An incident created in ServiceNow is synced to Jira as an issue. The short description and description of the incident must be reflected within the Jira issue. 
  • Comments (from Jira) and work notes (from ServiceNow) must be synced bi-directionally between the two platforms. 
  • SLA information related to the incident is synced to the correct Jira issue in a user-defined field. The following SLA information must be passed over:
    • Name of the SLA
    • Breach time
    • State 
  • State changes to the SLA record in ServiceNow must be correctly updated in the SLA record on the Jira side. 

Note: You can choose to populate the SLA information in any kind of Jira field you want. For this use case, we have considered a user-defined field called ‘SLA Info’. 

The Challenge

Syncing an incident from ServiceNow to Jira is pretty straightforward and can be achieved easily. 

However, syncing the SLA information to the Jira issue needs to be handled carefully.  

An incident triggers (creates) an SLA record under two conditions: 

  • An incident of high priority is created. 
  • An incident is assigned to a specific person or an assignment group.

Once, the SLA record is created, it must automatically be synced to the Jira issue in a user-defined field. Therein lies the real challenge; to find the correct Jira issue to add the SLA information. 

Also, state changes in the SLA record must update the SLA details on the Jira side. 

The use case is complex, so we must find a solution that handles this complexity easily. 

And we have just the right solution for you. 

Exalate: A Customizable Integration Solution

Exalate is a bi-directional, fully customizable integration solution that helps integrate applications like Jira, ServiceNow, Salesforce, Zendesk, GitHub, Azure DevOps, etc.

We opted for Exalate to execute the use case because of the following reasons: 

  • User-friendly Scripting Engine: It features a Groovy-based scripting engine that simplifies the configuration of intricate logical mappings between entities that require synchronization. 
  • Advanced Automatic Sync Triggers: It provides a range of fine-grained triggers that enable automatic data sync. 
  • Independent Control of Information Flow: It provides admins on both integrating sides to have independent control of the information and allows them to fine-tune the sync as per their requirements without consulting each other. 
  • Bulk Sync of Entities: It allows syncing entities in bulk, simplifying the sync process for large datasets. 

Note: You can learn more about Exalate through its Academy videos. 

How to Sync SLA Information From ServiceNow to Jira Using Exalate


  • Install Exalate on Jira (Cloud) and ServiceNow
  • Create a connection between Jira and ServiceNow using Script mode

Note: You can learn more about setting up a connection by referring to the Getting Started guide or the Jira ServiceNow integration guide. 

The Implementation

After setting up the connection, you must configure the sync rules, which are Groovy-based scripts that determine which information to exchange between Jira and ServiceNow. 

You can access these rules by clicking the ‘Configure Sync’ button after the connection is established or by editing the connection.

Jira ServiceNow integration

The ‘Rules’ tab is where you’ll find the scripts we discussed earlier. They exist in both Jira and ServiceNow. 

The ‘Outgoing sync’ determines what information is sent from the source to the destination, while the ‘Incoming sync’ specifies how to receive information from the source. 

The Scripts

Let’s see the actual scripts required to implement this use case. 

Remember, the scripts in the ‘Rules’ section provide some default behavior, like syncing comments, descriptions, etc. We must add our own scripting rules for the functionality we want to implement.

ServiceNow: Outgoing Sync Script

As such, from ServiceNow, we send the SLA information in the ‘Outgoing sync’. 

ServiceNow outgoing sync script

The code:

class SlaRecord {
    String name
    String breach_time
    String stage
    String linkValue

if(entity.tableName == "incident") {
    replica.key            = entity.key
    replica.summary        = entity.short_description
    replica.description    = entity.description
    replica.attachments    = entity.attachments
    replica.comments       = entity.comments
    replica.state          = entity.state
    def RelatedSlaRecords = []

    def limitResult = 20

    // lookup all related SLA records
    def response = httpClient.get("/api/now/table/task_sla?sysparm_query=task.number=${entity.key}&sysparm_limit=${limitResult}")

    if (!response || !response.result) return null  

    // For each SLA record, lookup corresponding value in contract_sla  //table
    // and collect all the data required within the RelatedSlaRecords array
    response.result.each { 
    SlaRecord temp = new SlaRecord()
    temp.breach_time = it.planned_end_time
    temp.stage = it.stage
    temp.linkValue = it.sla.value

    def slaRecord =     httpClient.get("/api/now/table/contract_sla/${it.sla.value}") = slaRecord.result.sys_name
    replica.slaResults = RelatedSlaRecords

Note: You can pick up any SLA information via Exalate and sync it to the other end. 

In the code above, we run an API query on the ‘task_sla’ table to fetch the related SLA records for that incident. After doing this, you can pick up the breach time, stage, and SLA value. 

However, if you want to pick up the actual SLA name, you need to run another API query to the ‘contract_sla’ table. From there, you can fetch the actual SLA name. 

We then package all of this within an object called ‘RelatedSlaRecords’ and send it to the other side. 

Also, it’s possible that you can have more than one SLA. The idea is to then use an array to populate all the SLA objects and send them to Jira. 

The job, on the other side, is relatively easy. All we need to do is to unravel the array that comes from the ServiceNow end.

Jira: Incoming Sync Script

We need to run a loop and iterate over all the fields from the array of objects sent from the ServiceNow side. Then display it in a user-defined ‘SLA Info’ field.

Jira incoming sync script

The code:

   issue.projectKey   = "UD" 
   // Set type name from source issue, if not found set a default
   issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.labels       = replica.labels

issue.customFields."SLA Info".value = ""
for(int i=0; i<replica.slaResults?.size; i++){
    issue.customFields."SLA Info".value += "Name: ${replica.slaResults[i].name} \n Breach Time: _${replica.slaResults[i].breach_time} \n State: ${replica.slaResults[i].stage} \n\n"

You don’t need any modifications on the Jira outgoing and ServiceNow incoming sides. 

Let’s run the program and see the output.


Begin by creating a simple incident.

Incident in ServiceNow

Set it in such a way that it triggers two SLA records.

The incident priority is now high and assigned to a specific user. And SLA records are created.

SLA information in Incident

Both the SLA records must be synced to the Jira instance. 

After syncing, the Jira side looks like this.

Jira issue with SLA information from ServiceNow

Remember, you can change the state of the SLA anytime. For instance, by changing it to ‘Cancelled’, you can see the updated SLA state in the Jira ‘SLA Info’ field.

SLA information in Jira from ServiceNow


By integrating platforms, modern businesses look to stay competitive and responsive to customer needs. The use case we demonstrated is proof of why integration tools will become even more critical in enabling successful collaboration between teams in the near future. 

Want to know if Exalate is the right solution for your business? It is just a click away

Recommended Reading:

Comments are closed.