Service Now to Jira, how to add additional tables (sys_user)

Hi

I am trying to Exalate two fields from Service Now to Jira. These fields are held in the ‘sys_user’ table and have the following in the Outgoing sync script:

if (entity.tableName == “sys_user”) {
replica.email = entity.email
replica.department = entity.department
}

I also have the following in the Jira Incoming script:

issue.customFields.“Requestor Email”.value = replica.email_value
issue.customFields.“Department”.value = replica.department

However, I have not been able to get this to work, please could you help?

Hi @cbrooks

Thank you for connecting with us via Community portal. Please share the following information:

  • Are you trying to sync the whole sys_user table to Jira?
  • Or, there are specific users or user groups from the table to Jira?
  • or trying to sync any user field(s) from SNOW incident to Jira?

Hi

I am looking sync the ‘email’ and ‘department’ fields from the sys_user table, from the person who raised the call in Service Now to Jira. I have created two new custom fields in Jira called ‘Requestor Email’ and 'Department to sync the data to. So far I have had no issues syncing data from the incident table in Service Now to Jira, but I have been unable to get any data from the sys_user table.

Kind regards

Colin

Thank you for sharing the information.
Let me have it checked and will get back to you in case further information is needed or any update is available.

BR,
Jillani

Hi @cbrooks ,

Hope you are doing well.

I believe you want to sync the reporter (caller) details from the ServiceNow incident ticket but you are trying to sync the sys_user table as these details are not directly available from the incident table.

What I’ll suggest here is can you please try the below code for fetching the email address of the user and let me know if this works or not.

Then we can try the same for the department.

ServiceNow Outgoing
if(!(entity.caller_id instanceof String)){
replica.caller_id = nodeHelper.getTableByLink(entity.caller_id?.link)?.email
}

Jira Incoming
if(replica.caller_id)
{
issue.customFields.“Requestor Email”.value = replica.caller_id
}

Thanks, Dhiren

2 Likes

Hi Dhiren

Many thanks for this, it worked. Can we take a look at the department field next.

Kind regards

Colin

Hi @cbrooks ,

Please try this. I have combined the code.

ServiceNow Outgoing
if(!(entity.caller_id instanceof String)){
replica.caller_id = nodeHelper.getTableByLink(entity.caller_id?.link)?.email
def departmentSysId = nodeHelper.getTableByLink(entity.caller_id?.link)?.department.value
def departmentRecord = httpClient.get(“/api/now/table/cmn_department?sysparm_query=sys_id=${departmentSysId}”)?.result?.first()
replica.department= departmentRecord.“name”
}

Jira Incoming
if(replica.caller_id)
{
issue.customFields.“Requestor Email”.value = replica.caller_id
issue.customFields.“Department”.value = replica.department
}

Thanks, Dhiren

Awesome! Thanks Dhiren