Launch a #ServiceNow Catalog Item from Email via Flow Designer (LIKE A BOSS)
this video is brought to you by me robert the duke fedoric 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 back to another episode of servicenow toolbox my name is robert fedork it is so good to have you here today i'm going to teach you how to use flow designer to launch a catalog item from an email but plot twist we are actually going to extract variable data from the body of the email this video will have five sections number one why number two but why not number three the main problem number four the setup and number five the prestige let's start with why because seriously why do i want to create a catalog item from an email look from my perspective a catalog item is just a way to trigger a known workflow it outlines what inputs are necessary and what flows to launch that it requires a form to input is just a bias from the era that the service catalog was invented but today we have all kinds of inputs that aren't form based we have virtual agent we have other workflows and we have integrations especially the poor man's integration email and look even servicenow agrees with me on this by virtue of the fact that catalog items can be both a trigger and an action in flow designer when i'm deploying servicenow solutions i always think about catalysts what is the thing that causes this work to start and sometimes that start is email just is if you want to learn more on the topic of catalyst check the description below really fast and i'll have a link to the cj and the duke podcast where corey and i break that concept down and now you're probably thinking robert why don't we just use inbound actions that's what we always used to do for incoming email and it pre-parses the email body so that we can extract name value pairs from the email to use as variables and that's a great question but here's why i want that in flow designer number one inbound action is a hundred percent script that makes it immediately much more expensive and much more vulnerable to mistakes second i might want lots of things to happen when i receive a certain email not just the triggering of the catalog item and while i may be able to script all those things it's just faster and easier for a lot more people to do it via flow designer but now that we got that out of the way you're probably thinking shouldn't this be really easy and yes using email as a trigger is super easy and yes launching catalog items from flow designer is super easy but here's what's hard inbound actions pre-parse the body of the email for us to extract name value pairs and let us use those variables via the script there is no out of box way to do this in flow design but wait can't i just grab the email body from the trigger section of the flow and then use the get values from name value pairs option in the transform menu well many have tried and the reason they fail is clear from the small print it states if data is not values in other words if it's not already an object of name value pairs then it's not going to work so the most important part of this solution is finding a way to parse that email body so that we can use the name value pairs inside of it as variables for a catalog item okay let's talk setup i know i'm gonna need a sample email to test with i'm just gonna reprocess this record i got here but a couple things to notice take a look at the body you'll see that there's tons of name value pairs in there and we're expecting to extract values for these variables first task second task and third task we also know we're going to need a catalog item with which to launch from email i've got one here called email triggered complex item just like traditional catalog item flows it is triggered via service catalog then it gets the variables and then it creates sc tasks we'll know this works if the subject line comes out correctly because the subject line is just writing a variable there you'll notice over here that the catalog item is expecting three variables first task second task and third task so we'll also know we've been successful if these three variables are populated on the requested item and remember our sample email had those as labels of name value pairs in the email body and we know we're gonna need something that flow designer doesn't already have to parse that email body for name value pairs now to solve that problem this is precisely why you would use a new action added to flow designer now we are not going to break down how to build this action in this video if you're not an aspiring developer this is something you would want a developer to build or download from share if you're an aspiring developer this is an excellent problem to deconstruct on your own while getting valuable practice from flow designer so for the purpose of this video we have downloaded an excellent custom action for flow designer from servicenow share shout out to its author benjamin sharer hope i pronounce that right links to the share item and ben's profile will be in the description below now for the aspiring developers who want to take a crack at this themselves i'm not going to show you ben's code but i will tell you exactly what the code does first it removes html tags second it finds the name value pairs in the body of text then it adds those name value pairs into an object that's the output of the action and lastly it removes any lines that aren't name value pairs a quick tutorial if you've never used share before first of all you go to developer.servicenow.com then you click the connect menu and then you click share the item you're looking for is called parse email flow action then you're just going to want to click this download button then from any list and service now right click and say import xml grab your freshly downloaded parse email flow action xml and then preview and commit it just like you would any other update set and now it's going to show up in flow designer under actions named parse email body text now that we've finally got the action we need let's do the build we know we needed a catalog item with which to launch from email this is a typical run-of-the-mill service catalog item flow we don't do anything special with this all i want you to note here is that the catalog is expecting these three variables first task second task and third task now what we also need is a flow that will listen for email and launch the catalog item this is all very standard flow designer stuff we've got an inbound email trigger here i'm just looking for an email that contains complex but of course when you do this you'll be a lot more specific right right okay then we plug in our parse email body text which is the custom flow action we either developed on our own or pulled down from share and all this needs is an email object to plug in which i'm going to grab from the trigger trigger email record [Laughter] [Applause] now in flow designer our variables are stored in this section which is storing the output of that custom action okay now that the parse email body action is getting the name value pairs for me i am going to extract them and put them in the catalog item request you see the catalog item request wants these three values populated so i'm going to take the email variables property from the parse email body text object i'm going to click this function field we are going to find the get item from name values transform and then i'm going to go to the key and put in third task i could also put something in defaults and this is what it will output if it doesn't find a third task key in my name value pairs hit save so if this works we should have successfully launched a catalog item that has variables that are pulled from the body of this email so now it's time for the prestige here i have the email up we're just gonna hit this reprocess email it shows us that an event has been created to process that email now i'm going to go into my flow designer and see the executions we'll first look at the order catalog item from email flow here we see an successful execution that happened just now so if it's a successful execution it must have also triggered the catalog flow here i am in the catalog flow let's look at executions and we see that one minute ago this flow launched as well if i pull up the latest created requested item we see that the variables have been successfully populated with what it found in the email body so there you have it folks using flow designer we were able to take an inbound email extract name value pairs as variables from its body and use those variables in a launch catalog item flow action thanks for watching as always the servicenow toolbox is looking for sponsors and content partners sponsors will receive a 30-second pre-roll of their brand message on every video in the sn toolbox for that month content partners will receive a portion of that ad revenue for helping me write the scripts for the show thanks for watching and i'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 the algorithm with likes shares and comments thanks for watching
https://www.youtube.com/watch?v=uLHCw2GA3lo