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:


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
}


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 })