Note

Currently, you cannot sign-up to the community. We're fixing the issue. Sorry for the inconvenience. Please use AIDA (check below) for any queries.

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

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Out-of-the-box syncing of User mentions cannot be done because the user ID that on the remote site has is does not match the same ID used by Salesforce uses.

To sync over User mentions, you would need to map the ID from the remote side to their site to the user's email address, so on Salesforce we can get which allows Salesforce to retrieve the User ID with using that email.


I have to two examples for Jira cloud & Cloud and Azure DevOps (they are quit quite similar, so this should work on other connectors too).

First, we will work on the outgoing script to transform the User ID to into the linked email.


Code Block
languagegroovy
themeRDark
titleJira Cloud Outgoing script
collapsetrue
// This function will accept a String and will replace & return the email linked to the User ID
def changeString(String comment){
  // Regex to find all user ID's
  def matcher = comment =~ /\[~accountid:(.*?)]/ 
  // If no match is found (The comment has no user mention in it) then return the comment.
  if (!matcher.find()) return comment
  
  // Iterate over all found matches and replace the ID with the found Email -> if no email is found but there is an ID then the email will be set to "johnDoe@tmp.com" by default
  matcher.each{
    comment = comment.replace(matcher.group(1), nodeHelper.getUser(matcher.group(1))?.email ?: "johnDoe@tmp.com")
  }
  return comment
}

// We collect all comments and change the mentions in the comment body.
replica.comments = issue.comments.collect{
  c ->
  c.body = changeString(c.body)
  c 
}

...