Demo Blog

It’s common knowledge that team members often tag (or mention) each other in comments for various reasons. 

You can use Exalate scripts to sync user mentions in comments between systems like Jira, Azure DevOps, Salesforce, etc. 

The following scripts would do the magic.

Jira Incoming Sync

for(comment in replica.addedComments){
    def newCommentBody=comment.body
    def matcher  = comment.body =~ /[~accountid:([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9_-]+)]/
matcher.each {
x->
    def target = nodeHelper.getUserByEmail(x[1])?.key ?:x[1]
    newCommentBody = newCommentBody.replace(x[1],target)
}
comment.body=  newCommentBody
}

def addedComments = commentHelper.mergeComments(issue, replica)
Jira incoming sync

for(comment in replica.addedComments){
    def newCommentBody=comment.body
    def matcher  = comment.body =~ /[~accountid:([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9_-]+)]/
 matcher.each {
 x->
    def target = nodeHelper.getUserByEmail(x[1])?.key ?:x[1]
    newCommentBody = newCommentBody.replace(x[1],target)
}
 comment.body=  newCommentBody
}
 
def addedComments = commentHelper.mergeComments(issue, replica)

object(WP_Post)#32947 (24) { ["ID"]=> int(33113) ["post_author"]=> string(2) "21" ["post_date"]=> string(19) "2023-09-18 14:36:17" ["post_date_gmt"]=> string(19) "2023-09-18 14:36:17" ["post_content"]=> string(0) "" ["post_title"]=> string(12) "Exalate Team" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(12) "exalate-team" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2023-09-18 14:36:17" ["post_modified_gmt"]=> string(19) "2023-09-18 14:36:17" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(58) "https://staging.exalate.com/?post_type=author&p=33113" ["menu_order"]=> int(0) ["post_type"]=> string(6) "author" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }

Comments are closed.