logo

NJP

How To Increase Efficiency in ServiceNow with Physical Outbound Attachments | Pharicode On Air

Import · May 11, 2020 · video

[Music] hi everyone welcome to fair code on air today's webinar is onboarding excellence how to increase efficiency with physical outbound attachments i'm janet i'm the vp of marketing here at fair code and i'll be monitoring the webinar today and i'm very excited to introduce you to our presenter michael rauch michael is a service delivery manager at fair code as well as a senior developer and trainer he has more than five years experience in servicenow and 10 years experience in i.t so he was originally a customer service now before working as a partner with fair code and has been involved in more than 20 implementations throughout his career so very excited to hear his insights and expertise on today's webinar just before we get started though we'd like to give some background information on ferrico so fair code is a certified small business association women-owned business and provides cutting edge technology services managed services staff augmentation to a variety of industries specifically federal state and local government we're very proud to have over 270 certifications partnerships specifically with servicenow which we'll be talking about today and as well as microsoft and um we'll be monitoring the q a today so definitely let us know if you have any questions that arise you can just drop those into the q a and we will answer them and as another perk of attending today we'll be giving away a 50 visa gift card so we're going to be announcing the winner at the end of today's session so do you stay on till the end um after michael's presentation probably lasting about 30 minutes until we get to the the q a so definitely please stay on and would love to hear your questions and answers so definitely pop those in and we'll get to those um after the presentation and demo so now i would love to hand things over to our presenter michael roch and we're going to dive in thanks jane i appreciate it so today we're going to talk about hr and onboarding and specifically we're going to talk about attachments just to start things off i just want to kind of go over kind of how this started so with the the use case that we had when looking up and doing research for the solution that we might go about this i saw a lot of questions in the community some things that weren't necessarily answered or weren't ideal solutions so once this is done i wanted to wait until this is over so i can go ahead and post that into the community as well just to give back so i just wanted to start off with a reminder if you if you solve a problem that you can't or you don't find a solution in the community if you could just give back just so you can get back to the community and all those other servicenow experts out there trying to help everyone out and give back as well so the table of contents here we're going to start out with is talk about the use case we're going to talk about how can we send email attachments from servicenow through email and how can why can we not use any of the out of the box options that are presented to us and how can we overcome these roadblocks and a quick demo and then q a so first off the use case this was from a large government organization that wanted to improve their hr on onboarding process and in this particular process it would take users maybe anywhere from a few months to almost a whole calendar year before they actually got onboarded to their first day they would go through a whole bunch of different screening processes so from the time the onboarding process would start they might not actually get access to servicenow so they wanted to keep the communication going they wanted to be able to give them documents and things like that without them actually having access to servicenow so this is a really interesting use case that we ended up solving for them so again these users will not have access to servicenow so they won't be able to click on any links to go to servicenow to download these attachments um they wanted these to be actual physical attachments on the email so it would look like any any other email that they might receive and they could easily find these attachments by searching through their email client and finding the files that they sent to them that actually had attachments on them and another big important piece that is always a big concern whenever we're talking about hr is we want to keep the integrity of the scoped application we want to we don't want to break or drill holes into any of the uh protections that are in place for the hr application so here i'm just going to do a quick overview of these three options that we have so we have the first option which is the out of the box option that you've probably seen before and might have used on the email notification field on the form you can actually see include attachments and this is a check box what this is going to do is it's going to actually put any attachments that are on the physical record that triggered this notification and it's going to put them in the email yes it will be physical email attachments they don't need to log into servicenow to access these attachments but this is only for the the record that triggers the notification and today we're using lifecycle events and with lifecycle events we have notification activities and what's actually triggering the notification is the parent case which i'll get into a little bit more later the next option option two is a male script so a lot of you i'm probably going to bet almost all of you have used this a lot of times when we're talking about email attachments from servicenow it's almost always going to be the male script that's the one that i like to use a lot and with this it's similar but you have to have access to servicenow and i'll kind of demo you that as well once we get further on and the last option which is the option that we used in this case is injecting the attachment into the email before it processes so servicenow creates the email and it goes through processing before it sends it and during that process processing process we're actually going to be injecting the attachment into that before it gets sent and why we cannot use option one in this case i already touched on it a little bit but this is going to be the the record that is going to be triggering this notification is actually the parent case so with life cycle events we have a parent case which is the entire onboarding case and you're going to have other child cases under it or child case activities and in those you might have users that want to use that parent case to hold other attachments maybe they want to hold the documents that the user sends to them on the parent case maybe they want to store information that comes back from the screenings on the parent case and if they did add attachments to that parent case then it'll also send all of the attachments that are associated with that parent case so not only the ones that they're wanting to send but also some that they might not want to send that's why sometimes the include attachments checkbox isn't the greatest option and another another thing to think about is what if someone deletes that record off that table because so many people have access to that record to that parent case that they might actually delete those attachments and then whoever you're onboarding might never receive those attachments so you have someone from your organization expecting to receive documents or expecting to receive some information or maybe even see someone on a specific date that never received that attachment so that first impression that you're trying to build with your new employee isn't going to be a very great one and also you're going to be confused as well because the person you're trying to onboard doesn't have all the information that you might think that they have the next one the mail script the biggest red flag with this one is that you don't have access to servicenow so they can't log in to be able to download these attachments and in this case we're actually taking data from another table that's not associated with the triggering table uh the triggering record so there's probably gonna be some additional scripting that you're gonna have to do in order to get the attachments that you want to be put in there the scripting is not gonna be difficult but you know that is gonna take a little bit more effort maybe a little bit more testing to get through as well and why we chose option three of course it's going to be sending physical attachments which is what they wanted um it's not going to be you know causing any issues with with the hr global hr scope and the global scope conflicts where we're going to be drilling holes into the hr scope or anything like that it's going to be keeping the integrity and everything that we want with that when when actually doing research and actually testing this there were ways that i could have got this done a little simpler ways with making connection to connections between hr and global but that's that's definitely not what we want to do we never really want to do that you want to avoid that as much as possible when you're working with hr or any kind of personal private information here we can actually leverage this for other areas of the application as well so this is scalable so if you do have other areas in your application that you might want to use this you can use it in those areas i built the tables kind of in reference to the event table so you're going to see parm 1 part 2 where you can store really whatever you want but what i would think you would store is the society of the record and maybe the table name that you're using and i'll kind of go into more detail once we get on that table and also you don't need access to servicenow in order to go through and download these attachments and there are two areas to the solution which i briefly touched on and we'll go into some more detail when we go through the demo is we have the global table and this is going to be a table on the global scope and this is going to hold the cis id of the record that's calling the event so the record that is calling the event to create the email and it's also going to hold the attachment next piece is the business rule and that's going to be on the sys email table and what that's going to do is it's going to run asynchronously on insert so it's while the record is being created and before it's finally processed we're actually going to be putting those attachments in to that record so it'll actually send that email all right and in this portion i do have slides to graphically go over these next areas but i think i'd rather go ahead and show you it in an instance so here we're on our dev instance and i'm going to just go ahead and show you lifecycle events so with lifecycle events we're going to go into managing activity sets so the hierarchy of life cycle events is we have activity sets so we have in this case we have pre-hire pre-boarding day 1 week 1 and day 30. and you can see when these are going to be triggered and when these are going to be created so pre-hire is going to happen immediately so as soon as they create their onboarding request they're actually going to be immediately applying these actions and within this activity set you can set orders of different activities to happen but with these activity sets the hierarchy is immediately it's going to start that pre-hiring activity set then once this pre-hiring is complete this is waiting on other activity sets which is the pre-hire then the pre-boarding starts and then in the pre-boarding process they're probably going to populate the higher date and that's day one day one is gonna fire when the hiring date is today and then that stuff starts and then week one and day thirty maybe for some reviews and things like that but you can kind of see where this use case really shines is because in this first section they're not they're not even boarded yet they're not even hired yet in the second section they're not hired yet still they still don't have they still might not have access to the system so we're going to go ahead and just drill down into pre-hire just so we can see um the different activities that we have here and this is on the lifecycle events scope we're only going to be here temporarily so i'll just go ahead and click here so we can get a better view of it and again at any point in time if anybody needs me to zoom in i can zoom in i'm already at 150 so i hope everybody can see this pretty well but if not let me know at any point throughout the presentation so here we can see we have our welcome notification which is the one i created and this is the one we're going to be physically injecting the attachment to and here we can see we have new hiring documentation account notification drug screening and background checks so you can see maybe an organization doesn't want to give servicenow access to somebody until they pass these screenings because there are going to be a couple different screenings that happen before the person's actually full-time hired on so you might not want to give them servicenow access before any of these screenings so that might be a use case for your organizations as well but in this case we're going to go ahead and end this welcome notification we're going to be sending that notification out open this up and now we're in the notification activity and in this notification activity we can see we're a part of the pre-hire activity set we can see the email template and i will bring this up just so we can see what this email is going to look like we can see here that this is on the servicenow hr lifecycle event case table we can see the subject and we can see the message so there's no scripting in the message no mail scripts or anything like that so we don't have anything that relates these attachments to this template or to this activity and again you can see in these that some of these you can put in actual external email addresses so these users that you're sending emails to or that you're sending these onboarding documents to might not have access to the system and you can also go through the case and actually go into the hr profile go ahead and show that here go through the hr profile and you can actually go to their personal email address so already out of the box you can already send emails to someone that doesn't have servicenow access from the information that you've acquired from the onboarding process so one thing i'm going to do is i'm going to go ahead and copy this society here just so i can kind of make things full circle towards the end of the presentation i'm going to go ahead and store that in this notepad so this is going to be the cis id for the welcome notification activity and we're going to see this come into play once we get into the actual outbound notifications table that i created all right so now that we've kind of went through an overview of what the hierarchy of lifecycle events are um get a better idea of how some of these onboarding processes look through the lens of lifecycle events we're gonna go ahead and take a look at the notifications here just to get another look this is where you typically send notifications and where you would typically include attachments so here you can see we have the tables and just using incident as a reference because maybe there's some people in here that might have a better understanding of incident that maybe they haven't implemented hr or onboarding yet and they're just looking at different options that they might take when doing their implementation so here we can see when this record's going to send who will receive these records and again you can put in external email addresses here as well if you'd like but there's those are going to be hard-coded or you can go through the actual records on the form to actually and dot walk through the user profile to get their personal email address if you have that information stored as well here is that include attachments checkbox even the pop-up information we can see that it's going to send all attachments from the triggered record as email as the email attachments so in this instance with incident i don't think you'd want to really send all of the email attachments on your incident to a user in almost any any use case because you might be sending them information that they don't want to see or that you don't want them to see and you might also not have that information on the instance because maybe someone deleted it or maybe it just didn't get attached to that record the next option that we talked about is the mail script so we see that down here and that's just going to be in the body of the html and we can actually go through just to look and we can kind of compare what this is going to look like with the script that we actually used in the business rule um just for anybody that hasn't seen this before for a quick rundown of what this script is going to do is it is querying the assist attachments table and it's taking the current society which the current society is the record that's triggering the notification and it is going through and it's finding all of the uh records that actually um all the records on the sys attachments table that are related to the current record that's calling the notification and what it's doing here is it's actually building an html so it's building a hyperlink to put on that notification and we'll show you what those look like towards the end when i show you what the actual end result is for all of this all right and the next thing we're going to look at is the outbound email table so this is the first piece of this solution that we're going to go ahead and show you here so you can have a ton of different outbound email attachments here um i think in our use case we might have had about 10 or more so in this table you can see it has the name this name is just going to be a describing factor that you can differentiate between all the other outbound email attachments on this table you can add another field for maybe a long description if you want something more robust and more detailed but these two parameters here you can think of these just like the parameters on the event table those parameters on the event table are just strings you can use these for however you see fit for any use cases that you currently have and it's with these parameters being so generic and so bland that you can use them for almost any use case in the future as well maybe you might want to add another field for the use case that you might have but extremely scalable super easy to understand especially if you under already understand the events table and how all those events work and again just so we can look i copied that cis id over and we can see here that the cis ids match so this pream1 is going to hold the sys id of the life cycle events notification activity so this is going to hold that record so that we know um what is actually calling that event and what's triggering that event so that we can use that later when we're actually injecting the attachment into the notification um some use cases that might pop up um would might be using this from multiple tables um so that's why i put this preamp 2 in here just so if you're using multiple tables you can't you can't put the table in the script so you would want to house it in parm2 so that you can easily just go in you can use parm2 to query the table use parm1 to create the specific record and again as you already know it's going to have the attachment up here and the attachment's not actually physically housed on this record it's actually housed on the sys attachments table and you saw this attachments table being queried in the mail script and then next what we're going to do is we're going to go into the business rule and kind of talk about the meat of this process and what it's doing and kind of talk through why i did it this way i had maybe three or four iterations that all worked all used completely different ways to copy attachments from the sastas table to the assist email table i just through doing testing i think i like this one better i think it's more efficient i think it attaches the attachment quicker and it gets through everything faster which is what we want servicenow is going to use and send a ton of emails an absolute ton of emails every day especially if you're in an extremely large organization you're going to be just sending out emails all the time so you want to make sure that you're not taking up any resources making it any slower to push out any emails just like with any any other time you're doing scripts you want to make sure you optimize optimize optimize here it's going to be on the sys emails table so this is where the emails are created this is where they're sent and this is where they're stored after they're sent for record keeping purposes when are we going to send it we're going to send it asynchronously because we want we want to inject this notification or this attachment into the notification before it is sent out we also want to do it on insert because we don't want to do it when it updates or deletes we want to do it as soon as the record is inserted we want to try to get that attachment in there as quick as possible and then here i'll go ahead and full screen this so we can see this better kind of break my formatting here so that we can see it in chunks it's easier to wrap our head around all right so with this you're going to see current in here a lot current is going to be the current email that's being created so this is the email that's currently in processing the first thing we're going to do is we're going to look for the sys email log before doing this i've never messed with this email log before i've never had to get information from it and i was absolutely surprised at how much information is actually in there and that i could run this whole thing off of the information that i'm given from the assist email log so here what we're going to do is we're going to get this this email log and what we're looking for is we're going to look for the cis email log that has the current society like i mentioned before this is going to be the current email that's being created once we have that sys email log since in this use case it's only on one table so i want to make sure that it is the it is the email that i want and that it's triggered by the notification activities because i don't want to process this whole script on every single email because again we always want to make sure that it's optimized so here we're making sure that it is sent from the notification activity and this is the name of the event next we're going to query the outbound email table the one that i just showed you just so we can look and find that record and here we can see that in our just by going through the dot walking we can see that we're looking at the email log and then we are going into the event field and then we're drilling down into the event field which is a reference field drilling down to get parm2 and in parm2 what that's going to do is is actually going to store the society of the record that fire the event and in that record that fire the event we can actually get that society and then that cis id will be able to query our tables in order to actually go through and get our attachments and here we're going to do a quick check just to make sure that it exists and then next we're going to query this attachment table just like we created in the mail script but here we're going to use a little different method to get this information so there's a couple different ways you can do it some of the other options that i ran into i was using i was using a while loop to loop through and get all the different records on the sys attachment table and then inject all each one of those into the into the email but with this it's all through uh one line of code that i found it's actually really really neat because you give it one record on this attachment table and it's going to copy all of the records um all the records that actually have attachments that are related to and similar to this one so here you can see that in the first section here it's going to be going through the target table name so in this instance we're going to go through the sys attachment table that's going to be the target table the target system we're getting the sys id of that attachment record because again like i mentioned the attachments aren't being stored on our custom table that we made it's not being stored on the outbound email table it's being stored on the sys attachments table next we're going to be where what's the table that's going to be receiving these attachments so it's going to be the current table that we're working in which is the sys email table then what's the record it's the current sys id which is going to be the current email address that's being or the current email that's being processed and again if anybody's not familiar with emails in servicenow is they go through a processing process where they start out as being processed so they'll be in the out box and then once they're actually fully processed and sent they get moved into the sent box so we are wanting to put this attachment in before it gets into the scent box and that's why we're doing it asynchronously and also another really important reason why we're doing it asynchronously is because the email log actually isn't created if you do it on before so on before you're going to be cr you're going to be looking for this this email log but it's before the email is processed so that this email log doesn't exist and if you do it on after then the email's already sent the email's already been processed and created and sent so that's another thing to think about all right i think that is everything that i have for this i'll go ahead and go back to the slides and if anybody has any questions feel free to think of those and put them down in the chat and if anybody needs to contact me afterwards if anybody wants once the script or anything like that any reference material that i might have ran into or any information that i ran into and researching the solution feel free to reach out to me or email me at michael.roush at fairco.com or michael.roush at glidefast.com or reach out to me on linkedin um really any any form of media that you'd like to reach out i would gladly respond all right michael i'm gonna come back on hey everyone we actually we did get a few questions so we can start from the top if that works for you um so this you can see the first one it says here we use the out of the box include attachment option for notifications on incident but don't like that the attachment has to be on the incident form where users and technicians can view and delete it could this be used for outbound emails from incident as well so that's that's a great one i think and um again uh excellent presentation so if anyone has more questions keep um sending them over so the question again is could this be used for outbound emails from incident as well if you want to take that right yeah so this could definitely be used in incident as well so you would just really go through the same process but instead of in the script calling out the lifecycle events activity notification event maybe you'd want to create your own event so that you could uh call that whenever you need to in your incident but of course yeah you can do that through there if you want to do that to incident and in addition do it through the hr life cycle events you could again leverage that parm2 that i showed where you can store the table name of each process so that you can actually use both of those in your scripts and then it looks like there is another question if we're working in the global scope is the table outbound email attachments needed i wouldn't say that it's needed necessarily but i think it's a really nice perk because you actually have a place to store your email attachments outside of the incident form so i think i would think that's extremely important i never really thought about that use case until this came to me and i saw all the different ways that you might be able to use this throughout servicenow but if you didn't want to you didn't have to you wouldn't have to create that table you could just go through not you wouldn't have to use like let's say use incident again as an example you wouldn't have to use incidents so you could trigger the notification from incident event or through an incident notification and use that script to actually go through and call that um the attachments that you want maybe they live on another table maybe it's from a knowledge article um that you think is important and you can actually use that script to take attachments from another table and then inject that into your email excellent all right we have a third question that just came in as well if anyone has any others feel free to fire them over so the question is in your research to resolve this use case was there any other interesting ways to manipulate the attachments and servicenow that you discovered huh that's a good one yeah so that one um there was actually a really cool one it was a video actually that i found it was someone sending outbound email attachments um through flow designer so i thought that was really interesting i really wanted to use it because i think a flow designer has a lot of really cool features but i didn't i couldn't find a real good place to fit that in with life cycle events and also be able to leverage that flow designer for that particular piece but i really liked it a lot because there's a lot of cool things that you can do in flow designer and i haven't seen anybody really leverage attachments or anything in flow designer yep all right michael i think those are all the questions that we had come in for today um but of course if anyone has any follow-up um you can reach out to michael via email we'll be sending this recording as well so you can just respond to those emails with any questions or follow up um we'll also be sharing this content um publicly available so you can refer to it um and all the script and all the great information in your free time so thank you again everyone for yes the recording will be uploaded um questions came in so we're gonna share it on youtube so you'll be able to access it there and then all of um those who attended and registered will be getting an email so you'll get that um pretty quickly actually all right and i think it's a good time for us to announce our winner for the gift card alrighty um so we're very excited to share that um the winner of the fidela visa gift card today is kevin hall so thank you so much for attending today um participating we hope you've received some valuable information and we'll be sending you an email to um receive your gift card and if you didn't get if you weren't the winner no worries um we are giving away um a grand prize for all of our webinar series so far code on air is happening now um through the end of june so do check out our website to register for more webinars and we are giving um so when you as many as you attend that will be an entry into our grand prize and we're giving away one of these workout mirrors here so it's a 1500 value we'll be selecting the winner at the end of june at the end of our series great um and thank you everyone um for attending and i don't know michael if you had any final words of advice or just wanted to jump in before we close um today's webinar oh no i don't have anything i just want to thank everybody for attending i appreciate your time and again feel free to reach out if you have any questions about this or really anything else servicenow related that you can think of excellent yeah so thank you everyone for attending um feel free to reach out to us on social media on our website um and you can go and get access to more sessions at farecode.com forward slash um on fire code on air um we'll send that information all on social media and email so it will be available to you and thanks again everyone appreciate it [Music] [Music]

View original source

https://www.youtube.com/watch?v=DprR7W1JfDI