Setting up incoming Jira from Service Now RITM's

I am struggling to set-up the incoming script on the Jira side when sending Service Now RITM’s.

Is the following correct??

requestItem.summary = replica.summary
requestItem.description = replica.description
requestItem.customFields.“MyIT Ticket”.value = replica.key
requestItem.comments += replica.addedComments

FULL SCRIPT:

if (firstSync) {
issue.projectKey = “DTT”
// Set the same issue type as the source issue. If not found, set a default.
replica.issueTypeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: “Request”
}

if(replica.issueTypeName == “Request”) { // if the received issue typeName is Improvement create Request Item on ServiceNow

requestItem.short_description = replica.summary
requestItem.summary = replica.summary
requestItem.description = replica.description
requestItem.customFields."MyIT Ticket".value = replica.key
requestItem.comments += replica.addedComments

requestItem.comments = commentHelper.mergeComments(requestItem, replica)
requestItem.attachments += replica.addedAttachments

}

requestItem.comments += commentHelper.mergeComments(issue, replica,
{
comment →
comment.body =
“[” + comment.author.displayName +
" | email: " + comment.author.email + “]” +
" comentou: \n" +
comment.body + “\n”
}
)

Or should I be using a different syntax?

Many thanks in advance.

1 Like

Hi,

I wasn’t quite sure where this is failing for you, so included a quick video here:

These are the scripts in my case:

SNOW Outgoing:

if(entity.tableName == "sc_req_item") {
    replica.type_name = "sc_req_item"
    replica.key = entity.key
    replica.summary = entity.short_description
    replica.description = entity.description
    replica.comments = entity.comments
    replica.state = entity.state
    replica.attachments = entity.attachments
    replica.number = entity.number
}

SNOW Incoming:

if (firstSync) {
// For the first sync: Decide the entity you want to create based on the remote issue type
entity.tableName = "“sc_req_item”"
}


if (entity.tableName == "sc_req_item") {
    entity.short_description  = replica.summary
    entity.description        = replica.description
    entity.attachments        += replica.addedAttachments
    entity.comments           += replica.addedComments
}
// Sync any other entity using the table name and the entity variable
if (entity.tableName == "cmdb_ci_business_app") {
    entity.short_description = replica.summary
    entity.description = replica.description
}

Jira Outgoing
No change to default scripts

Jira Incoming

if (firstSync) {
    issue.projectKey  = "CM"
    // Set the same issue type as the source issue. If not found, set a default.
    issue.typeName    = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.labels       = replica.labels

Hope it helps!

Thanks
Majid

1 Like

Many thanks for this Majid

Looking at some of your documentation, I was under the understanding that I had to use the prefix of “requestItem” for the Jira incoming script rather than “issue”. This makes a lot more sense now.

1 Like

Indeed. We will get the documentation amended as well, but I am curious to check if this actually solved the issue bi-directionally for you.

@Javier can you please take the documentation piece from here on in.

Thanks

Hi Majid
Yes, I have successfully set-up the initial bi-directional flow based on your update. I now have a new query regarding RITM variables which I will raise a new question on.

Many thanks again for your assistance and help on this.

1 Like

Glad to hear that!
Thanks

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.