Copy Attachments from Incident to JIRA Issue using flow designer Spoke.

Ravi Srikanth
Tera Contributor

Hi,

I have a requirement to Copy attachments from an Incident record to JIRA Issue using the flow designer spoke. I have built below flow and I am able to copy the attachment, but for scenarios like when I have multiple attachments my flow is copying only the first attachment. 

Scenario 1: For each single attachment added to the Incident, I want only that file to be copied into JIRA issue. 

Scenario 2 : Assume a scenario when the incident record already has 2 attachments and when I attach the third attachment, I want only the third attachment to be copied into JIRA assuming the first two attachments are already copied into JIRA Issue.

Below are Options which I tried with no success. Please suggest any better approach to address this Issue. Thanks

Option 1 : Step 1. Lookup Attachment is always returning the first attachment, so always only the first attached file is getting copied into JIRA Issue. I tried For Each Loop condition also, when I use this it always copies all the attachments to JIRA, which will create duplicate copies. 

 

Option 1 tried : Trigger when Attachment is added onto Incident record.

find_real_file.png

 

Option 2:

I also tried triggering the subflow from an On-Insert Business Rule on the sys_attachment table, but here also Lookup Attachment is always taking the first attachment on the Incident record, even-though I am passing the sysId of the second or third attachment file.

 

Option 2 tried : Trigger Subflow from an On-insert Business Rule on sys_attachment table.find_real_file.png

find_real_file.png

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Since you are iterating over sys_attachment for that incident record you will get all the 3 attachment

For Option 1: When you are doing the Lookup action did you try to sort it by Created [A to Z] to get the latest attachment

Order By: Created a to z

find_real_file.png

Regards
Ankur

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

Hi Ankur,

Thanks for replying.

We do not have Order By selection option in "Look Up Attachment" Action.

and we cannot use "Look Up Record" action for doing attachment lookup, It shows sys_attachment table for selection, however we cannot pass the output of this action to JIRA "Copy Attachment" spoke. I already tried this.

 

Hi Ravi,

Did you solution for this? I was struck with the same problem and could not get the solution. Please share the solution if you have resolved the issue.

Thanks

dhazlettjr1
Tera Contributor

Not sure if this is helpful, however I use lookup attachment records (not record) to get all my attachments on issue creation.  I have not figured out how to get single attachments over after the incident is updated.

 

find_real_file.png