The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe

Introduction


Hello all,


Picture this: You've successfully synced Azure DevOps and Jira Cloud, with a fully operational JSM project up and running.


Now, suppose you come across a scenario where you'd prefer all attachments sent over to be treated as internal within JSM.


The solution lies in adding these attachments to an internal comment in JSM. By doing so, you ensure that these attachments remain hidden from the end-user's view while being accessible for internal purposes.


Let's dive in the code.


For the outgoing sync in ADO, we will send over the attachments like this:

Outgoing Sync ADO
replica.attachments    = workItem.attachments


For the incoming sync in JSM, we are going to add the attachments to an internal comment, included in this use-case is comment impersonation so if the user exists with the same email adres, the proxy user will change.


Incoming Sync JSM
if(firstSync){
   issue.projectKey   = "JSM" 
   issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "[System] Service request"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels





replica.addedAttachments.each { a -> 
    def comment = commentHelper.addComment("!${a.filename}!", [])[0]
    comment.internal = true
    comment.restrictSync = true
    issue.comments += comment
}

issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)

replica.addedComments.each { it.executor = nodeHelper.getUserByEmail(it.author?.email) }
replica.changedComments.each { it.executor = nodeHelper.getUserByEmail(it.updateAuthor?.email) }
issue.comments       = commentHelper.mergeComments(issue, replica, {it.internal = true; it})


Thank you.

Kind regards


Questions