Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Multiple attachments getting updated from ServiceNow to JIRA

Koyel Guha
Tera Contributor

Hi , 

I am facing issue while updating the attachment from ServiceNow to JIRA. When I am updating an attachment, it is adding duplicate attachments continuously in JIRA. but the comment is updated with the latest one as I have used look up latest comment update. 

 

Could you please me to get this fixed so that only the recent attachment gets updated in JIRA.

KoyelGuha_0-1754488538149.png

KoyelGuha_1-1754488584672.png

Any help is appreciated.

Many Thanks. 

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@Koyel Guha 

what's trigger for your flow?

In the image you are iterating over all the files for that record and then pushing it to JIRA

Are you keeping track of which file was sent earlier on the same record?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Update Incident is the trigger. Creation flow is working fine. but when I am updating the attachment, it is creating multiple attachments including the existing old one. 

Thanks. 

KoyelGuha_5-1754660842007.png

 

@Koyel Guha 

During creation, let all files go to JIRA.

When new attachment is added, your flow should be on sys_attachment so that it sends only that file for which the flow triggered.

In that flow you can similar flow actions etc.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

At the time of creation, the attachments are appearing fine. However, I am facing issue when I am updating an attachment in the ticket. It should only attach the latest one. However, it is attaching the latest as well as the existing ones.

Do you know the condition to be applied so that it should only take the latest one from sys_attachment table.

Thanks

Vishal36
Mega Guru

Hi @Koyel Guha

The issue you’re facing with duplicate attachments syncing to Jira while comments update correctly is a common challenge in integrations involving attachments.

Here are some things to consider and check:

  • Attachment Identification: Make sure your integration logic checks whether an attachment already exists in Jira before adding it again. Without this check, every sync cycle may upload the same file repeatedly.
  • Timestamps or Versioning: Use metadata like attachment timestamps or unique IDs to identify the latest attachment and avoid duplicates.
  • Lookup Logic for Attachments: Similar to how you’re handling comments with “lookup latest,” apply a similar approach to attachments so only the newest version gets synced or updated.
  • Cleanup or Deduplication Steps: Some integration tools offer settings or workflows to clean up duplicates or prevent re-uploading files.

If your current integration setup doesn’t support these checks well, using a platform designed for advanced sync logic can help. For example, OpsHub, an enterprise –grade integration solution and a ServiceNow Partner can handle attachment syncing with proper deduplication and update logic, reducing duplicate data and keeping systems aligned. Bidirectional deep data sync, all this without writing a single line of code 🙂

Hope this helps! Let me know if you want guidance on implementing these checks or more details on integration options.