# Sync Agile Accelerator custom objects from Salesforce to Jira (included threaded comments)

**URL:** <https://community.exalate.com/t/sync-agile-accelerator-custom-objects-from-salesforce-to-jira-included-threaded-comments/5308>\
**Category:** General Questions\
**Tags:** cloud-salesforce, exalate, migrated\_question\
**Created:** [November 4, 2024, 7:56am UTC](https://community.exalate.com/t/sync-agile-accelerator-custom-objects-from-salesforce-to-jira-included-threaded-comments/5308 "2024-11-04T07:56:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:56am UTC](https://community.exalate.com/t/sync-agile-accelerator-custom-objects-from-salesforce-to-jira-included-threaded-comments/5308/1 "2024-11-04T07:56:57Z")

</div>

_Originally asked by Syed Majid Hassan on 05 October 2022 [(original question)](https://oldcommunity.exalate.com/questions/58495171)_

* * *

Requirements:

- Sync Work items from Agile Accelerator module from Salesforce to Jira issues
- Ensure that the threaded comments on the Work in Salesforce and synced to jira

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:56am UTC](https://community.exalate.com/t/sync-agile-accelerator-custom-objects-from-salesforce-to-jira-included-threaded-comments/5308/2 "2024-11-04T07:56:58Z")

</div>

_Answer by Syed Majid Hassan on 05 October 2022_

Please use the following code snippet on the Salesforce outgoing script to ensure that the threaded replies are sent over as well:

Expand source

```auto
if(entity.entityType == "agf __ADM_Work__ c") {
replica.key = entity.Id
replica.summary = entity.agf __Subject__ c
replica.description = entity.Description
replica.comments = entity.comments.findAll {
    comment ->
    def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+from+User+where+id=%27${comment.author.key}%27")
    comment.body = nodeHelper.stripHtml(res.records.Name[0] + ": " + comment.body)
}
replica.attachments = entity.attachments
replica.Status = entity.Status

//Get the threadedComments of all chatter threads in this Work
def threadedComments = httpClient.get("/services/data/v54.0/query/?q=SELECT+Id%2CCommentBody%2CInsertedById+from+FeedComment+where+ParentId=%27${entity.Id}%27")

//For each threadedComment, read all the replies and append usernames to it
//Create a comment object with this info and add to the replica
for(int i=0; i<threadedComments.records.size(); i++){
        def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+from+User+where+id=%27${threadedComments.records[i].InsertedById}%27")
        def c = new com.exalate.basic.domain.hubobject.v1.BasicHubComment()
        c.body = res.records.Name[0] + " commented--: " + nodeHelper.stripHtml(threadedComments.records[i].CommentBody)
        c.id = threadedComments.records[i].Id
        replica.comments += c
        }
}

```

Please check out the explaining how this works:

[Agile Accelerator Threaded replies SF JIRA.mp4](https://oldcommunity.exalate.com/download/attachments/58495171/Agile%20Accelerator%20Threaded%20replies%20SF%20JIRA.mp4?version=1&modificationDate=1664974824086&api=v2)_(old community)_

Thanks

Majid

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 6, 2024, 7:57am UTC](https://community.exalate.com/t/sync-agile-accelerator-custom-objects-from-salesforce-to-jira-included-threaded-comments/5308/3 "2024-11-06T07:57:20Z")

</div>

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