Internal comments sync

Originally asked by Kiet Ngo on 19 August 2020 (original question)


Hi,

I have two instances which sync issues between, the connection is triggered by workflow post-function.

Let’s say instance #1, and instance #2.

The rules are same for both, we dont want to sync internal comments, only external comments.
When issue created from #1 and sync to #2, everything is working properly.
When issue created from #2 and sync to #1, internal comments from #2 are not synced to #1 which is correct, but internal comments from #1 are still synced to #2 which is not correct.

Please advise how to solve this issue.

Regards,

Kiet


Answer by Kiet Ngo on 19 August 2020

Outgoing sync

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.findAll { !it.internal }
...

Incoming sync

if(firstSync){
   // If it's the first sync for an issue (local issue does not exist yet)
   // Set project key from source issue, if not found set a default
   issue.projectKey   =  "TGT"
   // Set type name from source issue, if not found set a default
   issue.typeName     =  "Incident"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels
issue.comments     = commentHelper.mergeComments(issue, replica)
...

Rules are same for both instances.


Comments:

Francis Martens (Exalate) commented on 19 August 2020

Can you share your rule set?

Kiet Ngo commented on 20 August 2020

Francis Martens (Exalate) Hi, do you have any updates?

Francis Martens (Exalate) commented on 20 August 2020

To set the expectations - Community gets attention if time allows.

Is the outgoing sync you provided the one of Jira #1 or Jira #2?

Can you provide the incoming, outgoing sync of both ends and label it accordingly?

Kiet Ngo commented on 20 August 2020

Jira #1 TGT https://cevalogistics.atlassian.net/
Outgoing sync

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.findAll { !it.internal }
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
*/
...

Incoming sync

if(firstSync){
   // If it's the first sync for an issue (local issue does not exist yet)
   // Set project key from source issue, if not found set a default
   issue.projectKey   =  "TGT"
   // Set type name from source issue, if not found set a default
   issue.typeName     =  "Incident"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels
issue.comments     = commentHelper.mergeComments(issue, replica)
...

JIRA #2 IRL https://t9275.atlassian.net/

Outgoing sync

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.findAll { !it.internal }
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"
*/

Incoming sync

if(firstSync){
   // If it's the first sync for an issue (local issue does not exist yet)
   // Set project key from source issue, if not found set a default
   issue.projectKey   = "IRL"
   // Set type name from source issue, if not found set a default
   issue.typeName     = "Incident"
   issue.customFields."Request Type".value = "Operational Issue"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
...

Francis Martens (Exalate) updated outgoing/incoming sync rules for both instances.

Francis Martens (Exalate) commented on 20 August 2020

Are both Jira Service Desk or is there a combination Jira Service Desk / Jira Software

Kiet Ngo commented on 20 August 2020

They are both Jira service desk

Francis Martens (Exalate) commented on 21 August 2020

Further trying to understand

So when an issue is created in #1 and exalated to #2, internal comments are not synced.

But when the issue is created in #2 and exalated to #1, internal comments from #1 are being synced

This is strange because it is using the same outgoing sync.
Is the customer request type set on issue #1 which has been exalated? Just a hunch

Kiet Ngo commented on 22 August 2020

This is strange for me as well. Customer request type on both issues are set.

Francis Martens (Exalate) commented on 23 August 2020

Can you check the incoming sync on #1.

if(firstSync){
   // If it's the first sync for an issue (local issue does not exist yet)
   // Set project key from source issue, if not found set a default
   issue.projectKey   =  "TGT"
   // Set type name from source issue, if not found set a default
   issue.typeName     =  "Incident"
}
...

The ‘request type’ is not set (while it is on the incoming sync of #2)

Kiet Ngo commented on 23 August 2020

You’re correct. After changed the script to set Request Type it works properly. Thanks for your support Francis Martens (Exalate) !

Francis Martens (Exalate) commented on 23 August 2020

Please mark the answer correct (old community)

It is helpful for other exalate users.

David Loszewski commented on 12 May 2022

Could someone tell me how you would differentiate between the incoming sync and outgoing sync script? Where would you place them? When I go to Exalate→Connections, the script is the same for both the incoming and outgoing.

Francis Martens (Exalate) commented on 13 May 2022

Hi David Loszewski

Good question - assuming you have a scripted connection, you can distinguish

If your view is different - can you post a screenshot.

Francis Martens (Exalate) commented on 13 May 2022

Also, if you are in doubt how Exalate works - check the explainer video

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.