Originally asked by Kaleigh Garcia on 15 October 2024 (original question)
Hello Exalate Community**,**
I’m running into an issue where my Chatter posts from Salesforce aren’t syncing to Jira as comments, despite having set up an outgoing script in Salesforce and an incoming script in Jira. The strange part is that the reverse setup (syncing comments from Jira to Salesforce Chatter) works perfectly using the script and instructions provided here.
Setup Details
I’m using a Tech_Item__c
custom object in Salesforce and am trying to sync Chatter comments to Jira. The Salesforce outgoing script includes logic to:
- Pull Chatter comments with the author’s name
- Filter attachments, adding them to the
replica
to sync with Jira
What I’ve Tried
- Active User Status: Confirmed that the Salesforce user creating Chatter comments is active.
- Exalate Logs: Checked Exalate logs on both sides (Salesforce and Jira) and found no errors.
- Jira Permissions: Verified that the project and issue permissions in Jira allow for comments to be created and viewed.
- Script Simplification: Tested a simplified script with basic text-only comments, but still didn’t see any results in Jira.
Working Example (Jira to Salesforce)
The comments sync from Jira to Salesforce without any issues using the example script provided in this guide.
Questions
- Has anyone else encountered issues specifically with syncing comments from Salesforce to Jira?
- Are there any specific configuration settings or additional fields that might need to be mapped for Chatter comments to appear correctly in Jira?
Any guidance would be greatly appreciated!
Here’s the Salesforce outgoing script excerpt:
if (entity.entityType == "Tech_Item__c") {
replica.key = entity.Id
replica.summary = entity.Name
replica.description = entity.Description__c
replica.attachments = entity.attachments
replica.Status = entity.Status__c
replica.comments = entity.comments.inject([]) { result, comment ->
// Retrieve and format the author's name
def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+FROM+User+WHERE+Id='${comment.author.key}'")
if (res && res.records && res.records.size() > 0) {
def authorName = res.records[0].Name
comment.body = nodeHelper.stripHtml("${authorName} commented: ${comment.body}")
result += comment
}
// Retrieve replies to comments from Chatter feed
def feedResponse = httpClient.getResponse("/services/data/v54.0/chatter/feed-elements/${comment.idStr}")
if (feedResponse && feedResponse.body.capabilities?.comments?.page?.items) {
feedResponse.body.capabilities.comments.page.items.each { reply ->
def replyUserRes = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+FROM+User+WHERE+Id='${reply.user.id}'")
if (replyUserRes && replyUserRes.records && replyUserRes.records.size() > 0) {
def replyAuthorName = replyUserRes.records[0].Name
def c = new com.exalate.basic.domain.hubobject.v1.BasicHubComment()
c.body = "${replyAuthorName} commented: ${reply.body.text}"
c.id = reply.id
result += c
}
}
}
result
}
}