How can we sync user fields between Service Now and Jira Cloud?

Originally asked by Robert Horan on 08 December 2021 (original question)


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

requested_for > Reporter
assigned_to <> Assigned To
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, we are getting nothing but errors.

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

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?


Comments:

Serhiy Onyshchenko commented on 09 December 2021

Hello, Robert Horan
Thanks for raising this question in community
In order to assign / set reporter to a user on Jira Cloud, one has to get a reference to that user’s account.
Please, note down your current “incoming sync” script on Jira Cloud.

Have you tried using:

issue.reporter = nodeHelper.getUserByFullName( replica ... .display_value)

For reference: https://docs.idalko.com/exalate/x/zYErAQ

In case if it doesn’t work, please send your current “Incoming sync” script so I could further suggest possible actions.

UPDATE:
the idea here is that you’re currently assigning to an object which does not represent the user of Jira Cloud, but rather contains some info from ServiceNow:

issue.reporter = replica ...

But it needs to be converted into the proper Jira Cloud user via either of the methods

Which expect different things to be passed from ServiceNow: the first one Expects that you get the full name (otherwise known as display_value from the error you’d shared earlier), while the latter expects that you’d fetch the user email in addition to all the other info currently sent and share that through the replica in the “outgoing sync” script on ServiceNow side.

Please let me know if you have any questions on that
Regards, Serhiy.

Robert Horan commented on 09 December 2021

Thank you, Serhiy!

I cannot guarantee the display name would be the same between systems, so in that case getUserByEmail would likely be the way to do that.

Two questions:

  1. Will this work in both directions?
  2. What happens when there is no match?