When you use synchronisation between multiple Jira's to coordinate the work between multiple teams, you might be faced with the problem that you have the same group of users, but different user id's.
But whenever you need to sync for instance the assignee, and you want to be sure that the assignee on the target instance is the same user as on the source instance.
To implement such mapping, Exalate provides you a user lookup function based on the email address.
First of all make sure that the source Jira is sending out the assignee by adding to the outgoing filter
replica.assignee = issue.assignee
Second, on the target jira, use the nodeHelper.getUserByEmail to lookup the local user
issue.assignee = nodeHelper.getUserByEmail(replica.assignee.email)
It happens. Imagine that a new team member is added to one of the two instances and but not added to the other system. One might expect such problems to happen.
With the createUser method, you can add the user as required.
if
(userHelper.getUserByEmail(replica.assignee.email) ==
null
) {
userHelper.createUser(replica.assignee.username,
"welcome"
,
replica.assignee.email,
replica.assignee.displayName)
}
issue.assignee = userHelper.getByEmail(replica.assignee.email)
Assume now that you're reluctant to have users added at will, and leave this to your administrator. Another approach is to add a comment to the target issue, specifying that the assignee could not be set such that the administrator can take the next steps
def targetAssignee = userHelper.getUserByEmail(replica.assignee.email)
if( targetAssignee ==
null
) {
String message =
"""Dear [~admin],
Can you please create a user for $replica.assignee.displayName'?
The email address is '$replica.assignee.mail'
and assign this issue to the newly created user"""issue.comments = commentHelper.addComment(message, issue.comments)
} else {
issue.assignee = targetAssignee
}
Flexibility through scripting
There is quite a bit discussion about the fact that UI based configuration is so much easier than scripting, and that's absolutely true.
The issue with UI based configuration is that it limits you in your options to configure the synchronisation behaviour your business needs.
Whenever you bump into such limitation, you will have to wait for your vendor to adapt the product. You don't want to end up between a rock and a hard place - do you?
The flexibility of scripting provides you the means to implement any synchronisation case.
What is your point of view?
francis
Atlassian expert
Exalate
Belgium
42 accepted answers
5 comments