logo

NJP

Justin's Tokyo Features App - Behind the Scenes

Import · Sep 28, 2022 · video

[Music] foreign [Music] it's Justin thank you for watching and welcome to Justin's house in this video I'm going to take you behind the scenes of my new Tokyo features application if you haven't seen that video I show you what I'm doing with the application and basically how it works in this video I'm taking you behind the scenes and I'm revealing exactly how I configured it it's really not earth shattering it's a bunch of tables and some flows and custom actions and a scheduled import to bring that in just to remind you here's what a release note page looks like so this is what you're going to see as I move through this what we're populating what I'm after is what's the release note page when's the last time I looked at it when's the last time service now updated it and then what are the features included on that page and it could be changes it could be deprecations or it could be features so to do that I have a flow the flow the first thing is a trigger for a service catalog I've never used a service catalog item I just come on here and run this test whenever I want to run my flow because I'm weird but the first thing I do is I have a custom action to get the sitemap part so take a look at that custom action in that one I'm basically passing the base URL and the path to the sitemap XML so it's a rest step and I'm basically passing that URL and there's the path right so if you go to docs.servicenow.com sitemap.xml that's essentially what I'm providing to that particular action so if you look here there's the URL and there's the path that I'm providing to that action once I get that action it's going to take it and it's gonna parse it to an XML object so you I have a video where I did this and was able to pull everything and then essentially I passed that back um as an object to the um to to the action that called it right so back in the flow now I have that object that I can use from this particular action so if you look just above my head that get site map Parts actually has an object associated with it that I can then start going through that array or that list of sitemap parts okay so that's number one once I've done that once I've gotten that part I'm going to Loop through them that's just for each I'm going to try to look up and see if the record already exists if it does and the last modified and updated dull match I'm going to update it so I'm basically servicenow's changed something so I'm going to change something in my system if the lookup fails I'm going to catch that and I'm going to create a new sitemap parts record basically I looked it up and it wasn't there so I'm going to create a new one and now I have it okay so that's the first stage second stage is now that I have a record of all this now I need to go get those XML files so I'm going to look up all the records that I just created in the previous stage and then as I Loop through this I'm going to delete any attachments because I'm going to be saving an attachment and so if you run this more than once there will be attachments there so I'm going to delete it any just in case they're there then I'm going to get the sitemap XML okay so this is another custom action I did I'll show you what that looks like with that I'm going to pass the base URL docs.servicenow.com the path which I just got from the get sitemap parts and then the sitemap part record ID the record of where I'm storing that URL so that I can save the XML file to that record so in the rest step I pass the URL I pass the path and then I check this box down here to save it as an attachment on the record right so that's what I'm doing in order to get these XML files once I have that go back up here move down a little bit I actually update the sitemap record to say when eyeglass crawled it so assuming we found it attached it and I put a date on there then I look up a data source okay so a data source is where I'm going to do my import to the XML files I'm going to make sure there's no attachments on that data source record and then I'm going to look up where the scheduled data import so I'm looking at data source here to attach something to and then the job to do the import I'm looking up that record so basically I want to find that job now that job just so you know is sitting there inactive and has a date time on it doesn't matter because in this third stage I'm going to retrieve all the release note pages from that so I'm going to go find that attachment that if you look up here um I'm going to look at the sitemap part record say hey do you have an attachment if you have an attachment I'm going to go over to the attachment table and get that record and then I'm going to move that attachment to the data source okay so the data source is really really critical here let's take a look at that data source uh we'll go to here and data sources and down over here to import sets and I was really proud of this one because I learned something on this on this when I did this these XML files are going to have data in them and they're going to have data from Quebec and Paris and Rome and all that stuff so what I did uniquely for this XML file and when I import it yes there's a transform map and it's really simple it's those fields you saw in the release note pages but the X path for that I found a way to filter and say when you do this import only grab the release note Pages where the release note URL has Tokyo Dash release Dash notes in in the URL so therefore I'm guaranteeing I'm only getting the Tokyo stuff this is really important because I only want the Tokyo stuff because that's what I want to show you guys so after that I attach it so we've moved it then we update that scheduled import data record and basically what I'm doing is after I attach that file to the data source which is that move attachment I'm going to the job and saying now you're active I want you to start at this particular time so let's take a look at the script the script is telling the the start time to use the current date time when it pops up here in a second it's telling it to use the current date time plus 60 seconds I don't know why it's not showing there it is okay so we're getting the current date time we're going to add 60 seconds to it and then we're going to return the display value so that that gets set once we've set that value and activated it in theory the job should run in about a minute or 60 seconds I wait five minutes just in case the system's slow there's something going on then I'd go back to the data source I delete the attachment and then I update the schedule job to inactive now it might still be doing the import but the schedule job itself now is inactive and it won't run again it wouldn't run again anyways because of that start date time then I wait for 11 more minutes so essentially I've stacked up about a 15 to 16 minute window to process each one of these yes there's probably a more efficient better way to do it I was trying to crank this out in time for the Tokyo features so that I was able to get everything in there what I wanted and that essentially is what provides me all of my release note pages and uh what the next step is once I have the release note page I essentially double click on this particular one I go to the documentation site and then I manually looked at what was on that release note page and essentially see here new in the Tokyo release changes change in this release and sometimes there's a deprecation section so I really didn't have an opportunity to programmatically do that and I'm glad that I didn't because it gave me a chance to do this I copied and then I pasted this over into my feature so I'd come over here and I create a new feature I'm going to pause a second I'm going to show you a Time Lapse video of me doing this while I was watching some popular series on TV that I was able to just copy and paste while I was doing this [Music] foreign [Music] [Music] okay welcome back from seeing how I populated all of my features if you watched my previous video there's over 600 new features changes deprecations in the Tokyo release I am so excited about showing you all those now you've seen behind the scenes how I created the app that I did in service now again it wasn't Earth shattering but it's going to help me help you and bring to you all the cool stuff in Tokyo that you may want to see or that you may be interested and I'm definitely interested in so I hope you found this video helpful if you did please like Please Subscribe or share it with somebody who you think may be interested in creating their own application and servicenow to track features from the servicenow releases and until next time don't forget always be learning [Music] thank you

View original source

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