Add Actual Attachments to #ServiceNow Sent Mail
this video is brought to you by me robert the duke fedor in addition to my freelance servicenow architecture consulting i also do recruitment if you need talent hit me at the email address here my network is vast and i know all the servicenow roles from personal experience i don't send candidates unless they're totally legit and if you're looking to level up i offer free career coaching as well as resume reviews to any candidates that use me as a recruiter i place four candidates in january alone all with significant pay raises hey everyone welcome to another servicenow toolbox my name is robert fedorick it is so good to have you here today i'm going to teach you how to attach actual files to your emails and servicenow now some of you are probably wondering doesn't servicenow already do this um not really out of the box there's a mail script that you can add to your notifications that says attach links here's the code for it but look what it's actually doing it's building hyperlinks why because that's how servicenow handles attachments it provides links to get the attachments from the server and here's an example of the email as we can see hyperlinks but no physical attachments so why might we bother putting physical attachments on an email if we could just access them via hyperlink maybe we want it to be more obvious to our end users that the email has an attachment maybe we don't want to expose that we're using servicenow as a technology maybe the recipient of the email is a system and is expecting a physical attachment there could be tons of reasons why but how do you actually pull it off we need two pieces of knowledge the first is knowing how the cis email table works when sending mail service now creates the record in the cis email table in the state of send ready once the email actually fires the state of this cis email record is switched to sent now not many people know but anything that is attached to the cis email record will also send out as physical attachments on the email so if we know that intended outbound email is stored in the sis email table and we know that these records with attachments will send those attachments in the email then all we need is a utility that can copy attachments from the records we intend over to the records in the cis email table and that's where the glidesys attachment object comes in handy links to the docs site on this object will be in the description below to make this work you only need one business rule on the sis email table i want to warn you though be very careful about the conditions for this business rule you absolutely don't want to handle attachments this way for all of your email also keep in mind that the business rule is running off the sys email table which doesn't have a whole lot of reference fields or useful fields at all with which to govern conditions so you may even need to handle your conditions within the script bottom line know precisely when you want to handle attachments this way and craft your conditions appropriately and also remember document your solution before hell itself opens its slattering maw with which to consume thee anyway the critical part is right here before this sis email record gets inserted we want to take care of the attachments to send with it right away so we see it's marked as before insert now let's look at the script the script is using the glidesys attachment object that object requires four parameters to work the source table that will store the record with the attachments the source id which is the record that has the attachments the target table and the target record id in this scenario we'll know the source id because we can dot walk through that through the instance reference on the sys email record we could do the same thing by dot walking through instance to get to the cis class name of the source record we already know the table assist email so we're just gonna hard code that right in and the target is the current record being inserted so we'll just put the current society so what's the output of all this look like check out this email it's got an attachment on it let's check that out that's a really good point and there you have it folks adding physical attachments to your email is as simple as knowing one object and one business rule one very carefully conditioned business rule thanks for watching and we'll see you on the next one do you want your message in front of the best servicenow admins developers architects and product owners in the business want a conversation about your servicenow strategy and architecture you can reach me via my website at www.theduke.digital if you want to contribute to high frequency high quality servicenow content all you need to do is feed the algorithm with likes shares and comments thanks for watching
https://www.youtube.com/watch?v=2iFd0EJ_SU0