Copying Attachments from Inbound Emails to Records in ServiceNow Flow Designer
this video we'll look at how to copy attachments from an email uh to a record created using an inbound email flow in service now flow designer so I'm in a a test uh inbound email flow I have here the trigger is an inbound email and just for the sake of this I put subject is Daily report and so when I get an email that's a daily report on the subject I want to create an incident so nothing special here I just put short description test uh then the second action here is look up email attachments uh so I just need to specify which record I want to look it up and it's from the trigger record right which is this email record no problem um then so a single email can have multiple attachments so basically we get a an array back or or an object back from this uh so we have to cycle through that and for that we use this for each uh flow I guess we call it an action or flow logic and so for each of the email attachments returned by step two then we use the copy attachment uh action and this is where um for me anyway I got confused and ended up banging my head against the wall for about an hour uh before I being able to figure it out so let's get rid of this let's just say we're starting fresh here and so the attachment I want to copy is the email attachment that comes back from here from step three so here's the the rub here so I got to four each and what I was doing is I was like oh email attachment record all right great let me just drag that sucker right in there and then I put my target record which is this uh incident record right no problem uh now if I run this uh let's see test and I think oh gosh I had it set up so I just have an email here that I stuck an attachment on and we'll just use that to test I'm on a PDI so I can't really send it anything okay so this email has attachment on it we'll run that and it's going to give me a big fat error right so the record type sis email attachment does not match with attachment type table H uh so I Googled around and there is actually a helpful article here uh copy attachment action gives ER with this exact uh and it tells you how to use the uh attachment action uh copy attachment action uh so if we go back to here uh the the problem and it's really sort of a bug in flow designer is that this copy attachment action accepts any sort of record in here but in reality it should only it be from the CID uh from the CIS attachment table right all these are records from CIS attachment so this Source attachment should only uh accept uh actual attach assis attachment records and not records from any other table but it does so that can lead to an hour of banging your head against the wall so if we go back here email attachment record uh so that's an actual just a record that's not the actual attachment the attachment is in here uh attachment so if I go the attachment field now that links back to that's a reference back to this sis attachment table so I can do this and then I can test and of course the darn thing disappeared okay we'll run that and now we'll see it works fine right so everything's completed and if I go to the record that I was that was created we can see it copied the attachment over so the last thing I just want to look at is that CIS email attachment table uh because you can see where can I go that got too many windows open here we go so you can see what I'm talking about and so this is the one I I actually just fake created this record um and you see the attachment uh links back to the attachment uh table it's actually a reference field that goes back to the attachment table and this image is the attachment and then you have some metadata around the attachment uh uh right file name Etc uh so if you put this record into that field right this is not an attachment record so that's where you get that error uh on the other hand if you uh give it this field that is the actual attachment so that'll work for you uh so that is how you copy attachments from an inbound email to a record in surface now flow designer
https://www.youtube.com/watch?v=dVAEKCql4q4