Worklog sync from jira server to cloud

Originally asked by Yogesh Mude on 09 March 2021 (original question)


If Ganesh, Tejal, and Pradnya logged the time on the Jira server ticket then working should log as Yogesh user/author on the Jira cloud ticket.

And except for these three users if anybody logged the time on the Jira server ticket then the worklog should log as admin user/author on Jira cloud ticket.

For the same, I have gone through the below Exalate article and added code to the destination (Jira cloud) incoming sync for existing issues but it’s not working as expected.

https://docs.idalko.com/exalate/display/ED/Worklogs+synchronization

but Every time it’s logging the time as Yogesh author on Jira cloud, irrespective of the user who logged the time on Jira server.

final def userMapping = [
       "pradnya" : "yogesh",
       "tejal" : "yogesh",
       "ganesh" : "yogesh",
       "boudewijn" : "admin"
]
issue.workLogs = workLogHelper.mergeWorkLogs(issue,replica, { w ->
   w.author = nodeHelper.getUser(userMapping[w.author?.email]) ?: w.author
   w.updateAuthor = nodeHelper.getUser(userMapping[w.updateAuthor?.email]) ?: w.updateAuthor
   w.comment = "auto-synced worklog from Brain2"
})  
  
  


Answer by Francis Martens (Exalate) on 10 March 2021

Just checking. The userMapping is not mentioning emails - but the get on the map is

userMapping[w.author?.email]


I assume that the userMapping is modified to include on this post.

So - how to proceed

  • Can you check the value returned by
nodeHelper.getUser(userMapping[w.author?.email])
  • Can you hard code the assignment to w.author with 'nodeHeler.getUserByEmail(“admin@acme.com”)

Do some experiments to see where the script is not behaving according to your expectations and adapt accordingly