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:
- Will this work in both directions?
- What happens when there is no match?