# Show attachments in Jira Service Management comments

**URL:** <https://community.exalate.com/t/show-attachments-in-jira-service-management-comments/5312>\
**Category:** General Questions\
**Tags:** comments, attachments, migrated\_question, jira-servicenow-inte\
**Created:** [November 4, 2024, 7:57am UTC](https://community.exalate.com/t/show-attachments-in-jira-service-management-comments/5312 "2024-11-04T07:57:12Z")\
**Posts on this page:** 2\
**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:57am UTC](https://community.exalate.com/t/show-attachments-in-jira-service-management-comments/5312/1 "2024-11-04T07:57:12Z")

</div>

_Originally asked by Sonal Otwani on 11 October 2022 [(original question)](https://oldcommunity.exalate.com/questions/58495436)_

* * *

Hi,

I have connection from ServiceNow to Jira Service Management project. The attachments are synchronised from Snow to JSM. But I want to show these attachments in comments as well.

Does Exalate support this use case?

Thanks,

* * *

---

<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:57am UTC](https://community.exalate.com/t/show-attachments-in-jira-service-management-comments/5312/2 "2024-11-04T07:57:13Z")

</div>

_Answer by Sonal Otwani on 11 October 2022_

Hi,

Yes, this use case can be supported through JSM.

Here are the points as part of requirement of the use case:

- Snow will comments and attachments, so will sync comments as it is in JSM plus we will add one new comment which has all attachments
- If there are new attachments then new attachments will be shown in new comment
- e.g, You created incident with 2 comments and 3 attachments, in that case JSM will have 2 comments same as Snow and one additional comment which contains 3 attachment preview. Now if Snow tickets get update and have 1 comment and 2 attachment then in JSM you will have 2 more comments, one for comment of Snow and another for remaining 2 new attachments. so total 5 comments in JSM.

Here is the Script snippet:

```auto
issue.comments = commentHelper.mergeComments(issue, replica)
issue.attachments = attachmentHelper.mergeAttachments(issue, replica)

def newAttachments= replica.addedAttachments
def allNames=[]
  
newAttachments.collect {attachment ->
def fileName=attachment.filename

def matcher = fileName =~ /([^\\s]+.(?i)(gif|jpe?g|tiff?|png|webp|bmp)$)/ 
if(matcher.find())
{
         allNames.add("!"+fileName+"|thumbnail!")
}
else
{
    allNames.add("[^"+fileName+"]")
  }
}
 def newComment=allNames.join(" ")
def allComments=commentHelper.addComment(newComment, false,issue.comments)
int i=0;
for(comment in allComments){
    i++;
    if(i==allComments.size()){
    comment.internal=false
    }
}
issue.comments =allComments

```

Let me know in case of any concerns.

Thanks,

Sonal

* * *
