logo

NJP

Copy Attachment - JIRA SPOKE - SERVICENOW TO JIRA(Avoid Duplicates)

Import · Apr 28, 2022 · article

Hi everyone I am @Pranav Krishna Teja Devireddy.I am writing this article to help you copy attachments from SERVICENOW to JIRA using flow designer. It works for other tables also. After reading many articles I haven't found articles that helped me in avoiding the duplicate attachments, So In this article We will cover everything..... Happy Learning.

Step - 1) Since I am trying to integrate SAFe story record and JIRA Story I went with JIRA spoke. So, first go to servicenow store and request JIRA SPOKE installation to your instance.

Step -2) Now after setting up your creation flows we now come to copying the attachments but when we use a copy attachments action from JIRA spoke it asks for Issue ID and and attachment as in below Picture now to tackle that we can use "LOOK UP RECORDS" Action.image

Step - 3) Now create a "LOOK UP RECORDS" action and fill out details like Table name,conditions and order by for reference see below pic,

Action - LOOK UP RECORDS

Table - SYS_ATTACHMENT

Conditions - Table SYS ID is "Your record SYS_ID

Order By - Created - Z to A or A to Zimage

Step - 4) Now we may have more than 1 attachment present so we use an "IF logic" see below pic for reference and we put condition as count greater than or is 1(to put this condition use data pill picker select the previous action and you will be able to see an integer object "count" see the below pic for reference )image

Step -5) Now we got our condition in place but we need these attachments to be looped so that we can copy them so for that we use an flow logic called "FOR EACH ITEM IN" and just like before we use data pill picker to select our attachment(see below pic for reference)image

Step -6) Now In Final step we use copy attachment and use data pill picker to fill out necessary details(see first pic for reference) and for attachment field part we navigate through data pill picker and select "FOR EACH ITEM IN" action(see below pic for reference) and for Issue id it is different for everyone(for us it was correlation ID).image

Step -7) Now we are able to copy our attachments to jira but if the flow is being triggered continously or if used for update the record would be duplicated so for that we first have to add a custom choice field in sys_attachment table and give it 2 choices 1.YES

2.NO and now after doing this go to the flow we have configured and change the "LOOK UP RECORDS" Actions condition(see below pic for reference) to "and" "yours custom choice field name" is "NONE"image

Step -8) No for the final step we go and add an "Update Record" action under copy attachment and fill out necessary details like record,table,field

Record - Use data pill picker and again select "FOR EACH" > Attachment record(JUST LIKE STEP 6)

Table - Automatically Populated(IF NOT SELECT SYS_ATTACHMENT)

Field - Select "yours custom choice field name" and set field value to be YES(see below pic for reference)image

AND BOOM WE CAN COPY ATTACHMENTS TO JIRA AND ALSO AVOID DUPLICATES.

MARK HELPFUL IF YOU HAVE LEARNED SOMETHING NEW

Thanks,

Regards @Pranav Krishna Teja Devireddy

View original source

https://www.servicenow.com/community/now-platform-articles/copy-attachment-jira-spoke-servicenow-to-jira-avoid-duplicates/ta-p/2306008