Map the Assignee in Jira to Servicenow

Originally asked by Jonathan Gilbert on 04 February 2021 (original question)


Morning, I am trying to push the display value of the “assignee” in Jira to a String field in Servicenow. I have tried to do the simple mapping, but all that did was to display the key.

OUTGOING JIRA

replica.assignee = issue.assignee

INCOMING SERVICENOW

entity.u_assigned_to_in_jira = replica.assignee

I have then found a community post from Francis that advises the following code (which I have updated for my instance)

entity.u_assigned_to_in_jira = nodeHelper.getUserByEmail(replica.assignee?.email)?.key

But this only populates the sys_id of the user in the field, rather than the name.

Ideally I would like just the simple display value pushing from Jira, as we may have the situation that some Jira users are not listed in ServiceNow, so the 2nd solution would not work


Answer by Jonathan Gilbert on 12 February 2021

Hi Ariel

Thanks for your reply, I had actually tried that and it did not work. Francis actually resolved the issue by using the following:-

entity.u_assigned_to_in_jira = replica.assignee?.displayName

Notice it has the “?” just after assignee


Answer by Ariel Aguilar on 11 February 2021

Hi Jonathan,

In this case where you only want the displayName of the Jira assignee to show as text in the u_assigned_to_in_jira field, you don’t need to use the helper method “nodeHelper.getUserByEmail” because you don’t need to find a local user, you just want the displayName of the remote user as text, so the following line should suffice for this use case:

entity.u_assigned_to_in_jira = replica.assignee.displayName			

Thanks,

Ariel