The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe
Conditional Sync of Request Participants and Watchers in Jira Service Management from Jira Data Center
1
0
-1
4 answers
- 10-1
The following solution works for syncs between Jira instances, including a sync between Jira On-premise → Jira Cloud.
Place the following in Incoming Sync of your Jira Cloud.
def localWatchers = []replica.watchers.each { w -> def _localW = nodeHelper.getUserByEmail(w.email) if (_localW != null) { localWatchers << _localW // Add to the local watchers list if the user exists }}issue.watchers = localWatchers
Regards,
Javier Pozuelo
CommentAdd your comment... - 10-1
Hello Jaspreet,
Add the following code in the Incoming Sync of your Jira Service Management instance (Cloud).
issue.watchers = replica.watchers .each { w -> def _localW = nodeHelper.getUserByEmail(w.email) if (_localW == null) { throw new com.exalate.api.exception.IssueTrackerException( "Could not find user `${w.email}`" ) } }
Kind regards,
Javier Pozuelo
CommentAdd your comment... - 10-1
Looks like this is the solution if it helps anyone
Add this to the Source outgoing sync:
replica.watchers = issue.watchers.findAll{it.email.contains("@grantstreet.com")} replica.requestParticipants = issue.watchers.findAll{!it.email.contains("@grantstreet.com")}
CommentAdd your comment... - 10-1
I tried this but I'm not sure how to format for it to keep trying and not throw an error.
issue.watchers = replica.watchers.collect{w -> String userEmail = w.email if(userEmail.contains("@grantstreet.com")) {nodeHelper.getUserByEmail(w.email)} else {throw new com.exalate.api.exception.IssueTrackerException("Not External User")} }
- Ariel Aguilar
Have you tried?
issue.watchers = replica.watchers.collect{w -> String userEmail = w.email if(userEmail.contains("@grantstreet.com")) {nodeHelper.getUserByEmail(w.email)} else return }
CommentAdd your comment...
Overview
Content Tools
search
attachments
weblink
advanced
I’m looking to sync our Watchers field in Jira DC (on-prem) to our Jira Service Management instance (Cloud). Our Watchers include both internal and externals users in Jira DC but in JSM, I need these users to be added to Watchers (if internal) and Request Participants (if external).
I’m able to get all Watchers to Request Participants using this:
I’m not sure how best it would be to filter on the replica.watchers to create two collections or how to do an if statement to compare the email within the collect.