Note

We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again

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

The following use case describes how Salesforce comments can be impersonated in Jira Cloud. 


If the comment author is a user in Jira, the comment is impersonated, but if the user is not present in Jira, then the default proxy user is employed and the comment author's email from Salesforce becomes part of the comment body.


In order to do this, please use the following scripts:


Salesforce Outgoing Script
replica.comments       = entity.comments.collect {
    comment ->
    def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name%2CEmail+from+User+where+id=%27${comment.author.key}%27")
    comment.author.email = res.records[0].Email
    comment.body = nodeHelper.stripHtml(comment.body)
    comment
}


Jira Incoming Script
replica.addedComments.each { 
   it ->
   def auth_in_jira = nodeHelper.getUserByEmail(it.author?.email)
   if (auth_in_jira)
      it.executor = nodeHelper.getUserByEmail(it.author?.email) 
   else  
      it.body = it.author?.email + " commented: " + it.body
}
replica.changedComments.each { it.executor = nodeHelper.getUserByEmail(it.updateAuthor?.email) }
issue.comments = commentHelper.mergeComments(issue, replica, { it })