Historical attachment sync

Originally asked by Nishant Sood on 23 July 2020 (original question)


Hi Team,

I have two instance of JIRA one is on Private & the other one is Public. Whenever I am trying to sync historical attachments are not getting synced. Any new attachmet I am adding is getting synced but old attachments are not getting synced. Can you suggest some ways to do that or any rule that need to be added. Default rules are already there.Source: Jira Server/Datacenter (old community)


Comments:

Nishant Sood commented on 29 July 2020

Can someone please update on this if there is any solution.

Roman commented on 30 July 2020

Hi Nishant Sood ,

Have you tried using the connect operation and use Send all existing attachmentsin advanced option https://docs.idalko.com/exalate/display/ED/Connect+Operation ?

Nishant Sood commented on 30 July 2020

Hi Roman,

Yes I have tried it but it doesn’t work, I have not tried bulk connect as there are 400-500 issues.

Below are the rules.

INCOMING Rule

if(firstSync && replica.project.key == “TPE”){
issue.projectKey = “TPOHK”
issue.typeName = nodeHelper.getIssueType(replica.typeName)?.name ?: “Task”
}
if(firstSync && replica.project.key == “TPOHK”){
issue.projectKey = “TPE”
issue.typeName = nodeHelper.getIssueType(replica.typeName)?.name ?: “Task”
}
issue.summary = replica.summary
issue.description = replica.description
issue.labels = replica.labels
issue.comments = commentHelper.mergeComments(issue, replica)
issue.attachments = attachmentHelper.mergeAttachments(issue, replica) -this also tried
issue.attachments.addAll(replica.addedAttachments) - this also tried
// or issue.attachments += replica.addedAttachments
issue.components = replica.components
issue.created = replica.created
issue.updated = replica.updated
issue.resolutionDate = replica.resolutionDate
issue.affectedVersions = replica.affectedVersions
issue.fixVersions = replica.fixVersions
issue.originalEstimate = replica.originalEstimate
issue.remainingEstimate = replica.remainingEstimate
issue.timeSpent = replica.timeSpent
issue.environment = replica.environment
issue.status = replica.status
issue.resolution = replica.resolution
issue.type = replica.type
issue.priority = replica.priority

/*
User Synchronization (Assignee/Reporter)

Set a Reporter/Assignee from the source side, if the user can’t be found set a default user
You can use this approach for custom fields of type User
def defaultUser = nodeHelper.getUserByEmail(“default@idalko.com”)
issue.reporter = nodeHelper.getUserByEmail(replica.reporter?.email) ?: defaultUser
issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: defaultUser
*/

/*
Comment Synchronization

Sync comments with the original author if the user exists in the local instance
Remove original Comments sync line if you are using this approach
issue.comments = commentHelper.mergeComments(issue, replica){ it.executor = nodeHelper.getUserByEmail(it.author?.email) }
*/

/*
Status Synchronization

Sync status according to the mapping [remote issue status: local issue status]
If statuses are the same on both sides don’t include them in the mapping
def statusMapping = [“Open”:“New”, “To Do”:“Backlog”]
def remoteStatusName = replica.status.name
issue.setStatus(statusMapping[remoteStatusName] ?: remoteStatusName)
*/

/*
Custom Fields

This line will sync Text, Option(s), Number, Date, Organization, and Labels CFs
For other types of CF check documentation
issue.customFields.“CF Name”.value = replica.customFields.“CF Name”.value
*/

-----------------------------------------------------------------------------------------------------------------------------------

OUTGOING Rule

replica.key = issue.key
replica.type = issue.type
replica.assignee = issue.assignee
replica.reporter = issue.reporter
replica.summary = issue.summary
replica.description = issue.description
replica.labels = issue.labels
replica.comments = issue.comments
replica.resolution = issue.resolution
replica.status = issue.status
replica.parentId = issue.parentId
replica.priority = issue.priority
replica.attachments = issue.attachments
replica.project = issue.project

//Comment these lines out if you are interested in sending the full list of versions and components of the source project.
replica.project.versions =
replica.project.components =

/*
Custom Fields

replica.customFields.“CF Name” = issue.customFields.“CF Name”
*/

Answer by Roman on 30 July 2020

Nishant Sood I believe my colleague is already looking at this in EASE-5348 is that correct?


Comments:

Nishant Sood commented on 30 July 2020

Yes. I have raised an issue too for this.