Ruchita
September 1, 2025, 9:19am
1
While syncing comments from Jira Cloud to Salesforce, its observed that some comments are being synced back to the Jira Cloud issue, creating duplicate entries. This behavior appears to be random, making it challenging to identify any particular pattern.
Additionally, there is a requirement to send back the Salesforce status to a designated field on Jira Cloud. Consequently, the SyncBackAfterProcessing() call is present in the Salesforce incoming sync.
xl8bot
September 1, 2025, 9:19am
2
Hi and welcome to the Exalate Community!
Thanks for sharing your question or insight, we appreciate your contribution.
A member of the Exalate team or community will review this post and respond as soon as possible.
In the meantime, feel free to explore related topics or join other conversations. We’re glad to have you here!
Dhiren
September 2, 2025, 7:43am
3
Ruchita:
While syncing comments from Jira Cloud to Salesforce, its observed that some comments are being synced back to the Jira Cloud issue, creating duplicate entries. This behavior appears to be random, making it challenging to identify any particular pattern.
Additionally, there is a requirement to send back the Salesforce status to a designated field on Jira Cloud. Consequently, the SyncBackAfterProcessing() call is present in the Salesforce incoming sync.
Hi @Ruchita ,
Can you please share the full outgoing and incoming scripts from both the sides?
Additionally, can you also share the Exalate Version for both the nodes?
Thanks, Dhiren
Ruchita
September 2, 2025, 12:15pm
4
Exalate version for Jira Cloud is v.5.27.0 and Salesforce is v5.25.0.
Here is the relevant sanitized code -
Jira Cloud : outgoing script
replica.comments = commentHelper.filterLocal(issue.comments)
incoming script
issue.comments = commentHelper.mergeComments(
issue, replica, {
it.executor = nodeHelper.getUserByEmail(userMapping[it.author?.key]);it
})
Salesforce outgoing - this is configured to handle public/ internal comments from salesforce.
//Comments mapping
def id=entity.Id
def allCaseComments = htttpClient.get(“/services/data/v48.0/sobjects/Case/${id}/CaseComments”)
double comment_size_d=allCaseComments.totalSize
int comment_size = comment_size_d.intValue();
def allComments=allCaseComments.records
def SFComments=allComments.collect { c-> def comment = commentHelper.addComment(c.CommentBody, ).find()
def internal=true
if(c.IsPublished) {
internal=false }
comment.internal = internal
comment.id = c.Id
comment.created=null
comment }
replica.comments=SFComments.findAll{!it.internal}
SF Incoming -
def flag=0
if(!firstSync){
replica.addedComments.collect{ comment ->
def isPublish="true"
if(comment.internal){
isPublish="false"
}
def SFCommentId3=""
def commentBody = comment.body
if(commentBody.size() >= 3700){ // Salesforce comment characters limitation
commentBody = commentBody.take(3700) + "\\n---Truncated: max 3700 chars"
}
def res3 = httpClient.http(
"POST",
"/services/data/v54.0/sobjects/CaseComment",
JsonOutput.toJson(\[
"CommentBody":"\[${comment.author.displayName}\] commented: ${(commentBody)}",
"ParentId":"${entity.Id}",
"isPublished":"${isPublish}"\]),
null,
\["Accept": \["application/json"\], "Content-type" : \["application/json"\]\]) {
req, res3->
if(res3.code==201) {
SFCommentId3=res3?.body?.id
} else {
debug.error("Error while creating comment :"+res3.code+" message:"+res3.body)
}
}
if(SFCommentId3){
def trace = new com.exalate.basic.domain.BasicNonPersistentTrace()
.setType(com.exalate.api.domain.twintrace.TraceType.COMMENT)
.setToSynchronize(true)
.setLocalId(SFCommentId3 as String)
.setRemoteId(comment.remoteIdStr as String)
.setAction(com.exalate.api.domain.twintrace.TraceAction.NONE)
traces.add(trace)
}
flag=1 // post this hardcoded entity.status is set for comment addition
}}
Dhiren
September 12, 2025, 10:01am
5
Hi @Ruchita ,
Thanks for sharing this information.
I am currently testing this out and will get back to you asap.
The duplicate comment issue happens because there’s no proper tracking of already synced comments between Jira Cloud and Salesforce.
Without checking existing traces, the same comments get treated as new and synced repeatedly.
To fix this, use the traces mechanism to track synced comments and skip them if already processed.
Also, ensure filterLocal() works correctly and that SyncBackAfterProcessing() doesn’t resend comments unnecessarily. This will prevent random duplicates.
Let me see if I can somehow share some fix for this.
Thanks, Dhiren
We resolved this issue via support.