How can I use Exalate to sync user fields between Service Now and Jira Cloud?

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2021

I realize this is an Atlassian community space, but it's Jira related, and I could really use the help...

 

Using Exalate, I am trying to sync fields between SN and Jira, and it is just seemingly impossible.  Here are the fields I am looking to sync, SN on the left, Jira on the right.

 

 

requested_for Reporter
assigned_to <>  Assignee
watch_list Watcher

 

 

It gets a little more complex since one of the issue types we are trying to sync from in Service Now is catalog task, so that definitely messes with the field name there, but in any case, I am getting nothing but errors when trying to get info from SN to Jira.  This i the key transition point since the initial trigger is the creation of a catalog task from SN which creates a task in Jira.

 

Has anyone cracked this problem yet?  I can't even seem to get information to leave SN without an error.  For example - look at this anonymized error:

 

Error Detail Message:
Cannot cast object '{display_value=John Doe (JDOE), link=https://client.service-now.com/api/now/v2/table/sys_user/68cea2c52c4c32c0c8e2a692842efa26}' with class 'scala.collection.convert.Wrappers$MapWrapper' to class 'com.exalate.api.domain.hubobject.v1_2.IHubUser' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: com.exalate.api.domain.hubobject.v1_2.IHubUser(scala.collection.convert.Wrappers$MapWrapper)

 

Is there documentation which clearly states how to sync user data between these two issue trackers?

2 answers

2 votes
Dhiren Notani_Exalate_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2022

Hi @Rob Horan 

This is Dhiren from Exalate.

It's easy to synchronize user fields between ServiceNow and Jira. Let me give you a small example for Reporter/Assignee field.

Let's say you want to map Assigned To from ServiceNow with Assignee in Jira, and another one could be Caller (from ServiceNow) to Reporter in Jira.

Now comes the interesting part, the script that needs to be written ::

 

ServiceNow Outgoing Script :- (I am assuming you are trying to sync Incidents, but you can practically sync anything)

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

    if(!(entity.assigned_to instanceof String)){

  replica.assigned_to = entity.assigned_to.display_value }

if(!(entity.caller_id instanceof String)){

  replica.caller_id = entity.caller_id.display_value }

}

 

Now, when this payload comes to Jira,

Incoming Sync Script in Jira can be :

//issue.reporter = nodeHelper.getUserByFullName(replica.caller_id) 

//issue.assignee = nodeHelper.getUserByEmail(replica.assigned_to)

You can also set a default user value in case this infomation i

 

You may use any method in nodeHelper class, I hope this helps buddy! 

For more information regarding this please browse through the Exalate Documentation

 

Thanks,

Dhiren

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2022

Maybe I'm the kindergartener in here (I'll own that) but here's the thing.  By saying you may use any method in nodeHelper class, there seems to be an assumption that we would all know how to use that info, and I definitely wouldn't.  

I'm just saying this isn't quite what I would call easy :)

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 23, 2022

Hi @Rob Horan ,

 

(I'm a colleague of Dhiren, and also with Exalate)

 

We know that there is a learning curve here - and it is not easy for rooky users
The details of the nodeHelper class is detailed 
https://docs.idalko.com/exalate/display/ED/nodeHelper

Let us know how the documentation can be improved.

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2022

Thanks @francis ,

You know firsthand some of the difficulties we had getting certain things to work, and - at least I hope yu and your team know - how much we appreciated the advice and support your team provided while we were working through some syncs. 

For many, I think the learning curve starts with not knowing where to begin.  There's a certain level of knowledge expected going into this documentation, and where/how to go to get that knowledge can be more nebulous.

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2022

@Dhiren Notani_Exalate_  I meant to pass along my thanks earlier and I didn't, and for that I also pass along my apologies - and yes thanks as well!

So this is going back months, and I had to dig deep in my email to get the info back.

We solved this, but it took a lot of work - FAR more than what was written above.

Can I honestly say I understand how this works?  No - and that's my concern.

On the SNow side, the outgoing sync looks like this:

  if(catalogTask.assigned_to && catalogTask.assigned_to != ""){
    //We only get inside this block if the assigned_to has a value
    replica.customKeys.assignee_email = nodeHelper.getTableByLink(catalogTask.assigned_to?.link)?.email
  }
  replica.customKeys.reporter_email = nodeHelper.getTableByLink(catalogTask.requested_for?.link)?.email
  
        DateFormat formatter = new SimpleDateFormat(datePattern);
        replica.due = formatter.parse(catalogTask.due_date);
}

 

And then in Jira

def snow_assignee = nodeHelper.getUserByEmail(replica.customKeys.assignee_email)
// only changes issue.assignee if remote assignee is found
if (snow_assignee) {
    issue.assignee = snow_assignee
     
}
// debug.error("assignee = ${snow_assignee}")
 
def snow_reporter = nodeHelper.getUserByEmail(replica.customKeys.reporter_email)
// only changes issue.assignee if remote assignee is found
if (snow_reporter) {
    issue.reporter = snow_reporter
     
}
0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2022

Hi @Rob Horan ,

First of all: I‘m mainly dealing with Jira Automation and also rooky exalate user. 

From Jira automation i now that the field „Assignee“ (and i guess also the field reporter and watcher) take the userID instead of the display_value (which is the name that is shown in Jira fields and is showing in your error message). 

So this is just my personal guess but could that be processed with a script to match the name that is sent from SN with a Jira User and get the userID to fill in into the fields in Jira?

Pleasr let me know if this might be helpful or if there are any further questions.

Best
Stefan

Suggest an answer

Log in or Sign up to answer