ServiceNow XML Parsing in Flow Designer
[Music] hey everyone it's justin thank you for watching in this video i want to show you something new i learned and that is parsing xml within an action that i can then use in flow designer so what am i up to i'm trying to manage the tokyo future releases and i'm trying to get out in front of it so i know what i've covered and what i want to cover and the approach i'm taking is i'm going to grab the site map or site maps from the servicenow doc site so what i had to figure out was how you parse xml which is what those site maps are so the first step that i'm going to do is i'm going to do a rest step i want to basically call and get that xml file from servicenow so i'm going to define my connection inline i'm going to set the base url to docs.servicenow.com hopefully you are very familiar with that site and i'm going to set the path for that to sitemap.xml now of course i look this up before making the video that that's the actual path for that and that's it that's all i'm going to do i'm going to test that and the reason i want to test that is i want to grab the xml so that i can use that in the parse xml step so i'm going to go over the execution details this is also a good way to confirm that my rest step actually worked we'll come down here and look at the response body and we see the response body has a bunch of files and a bunch of xml so if you look really closely this is going to be a couple part video the sitemap.xml for the docsite is actually a list of sitemap parts so the site's so big that it exceeds the 10 megabyte limit for a sitemap and so they're broken into about 29 or 30 parts that we're going to actually go through in my flow designer but for the purpose of this video i want to show you how to parse xml which is i've learned today i didn't know how to do it before so we're going to grab this xml parser step that we're going to add to the action after we make that rest call so i've got the step i can specify the source data so right here by using the response body from my rest up right because that has the xml on it so i just drag and drop it here but notice above my head i still don't have an object that i can actually use so what you do is you take that xml that i just copied when i tested it paste it into this window over here and then we can generate the target object so you see here i've got now my sitemap index with my sitemap which is an array and inside that is a location and a last modified coming from that site map so i've got everything i need there now in this particular step to pass back to my workflow and actually use it in my flow to go grab the individual sitemaps so last step i got to do here is i've got to create an output and so we'll just set this one to docs high level site maps it's going to be my variable and i'll go ahead and make that this name of it as well we'll keep the underscores it is going to be a string let's see this string or do we have a complex object so there is let's do an array object like this and yeah that should have everything i need and once i'm done with that now i should be able to drop in my sitemap index which is right here it's kind of above my head so when i did that xml parser step it created the sitemapindex object so i'm going to take that i'm going to drag it in so object is not allowed here that's interesting what does it want edit outputs let's see let's go change this to an object let's try that and get out of exit mode and then we'll try dropping dropping that in again which it does let me and so now i have the data rest query parsed the xml created an object and now i can use that object within my flow to go do the same thing again basically and retrieve each of one of those xml files and then from that i'm going to start working through the different pages when they were last updated and i should be able to start pulling in all the features by reading those pages so i hope you found this video helpful if you did please like please subscribe or share it with somebody who you think might be interested in xml parsing within servicenow and until next time don't forget to always be learning [Music] [Applause] [Music] you
https://www.youtube.com/watch?v=JkJTyunEyfA