How to include author in the script - Jira server to Jira cloud

Originally asked by Jose Pablo Alpizar Hidalgo on 15 November 2022 (original question)


We are syncing data from Jira cloud to server. We do have user name mapping which is used for assignee,reporter and for commnets.

How to use user name mapping for history?

I can see “author” as an field for change history. How to include that in our script to use the user mapping.

issue.changeHistory = replica.changeHistory
  

How to include author in the script

I can see something like history.author.displayName


Comments:

Support commented on 12 December 2022

Please follow the link to verify how to Synchronize Issue Change History in Jira On-premise to check the details to show the comment author, also visit the solution already set on the community post: Sync comments when users do not exist in the remote system
then try to implement the following:

issue.comments = commentHelper.mergeComments(issue, replica){ comment ->  comment.executor = nodeHelper.getUserByEmail(comment.author?.email)  if(comment.executor == null){     comment.body = "Comment from servicenow by "+comment.author?.username + "\n:" + comment.body  }}