logo

NJP

My First Transform Script

Import · Nov 09, 2023 · video

[Music] hey everyone it's Justin thank you for watching and welcome to my house in this video I have something different for you it's my first transform on a transform map I know I've been doing service now for quite a bit but I've only used trans for maps to import things into service now and I haven't actually had to transform anything the first use case actually came up yesterday SL today I was uh had my regular store crawl going on preparing for Friday's service now store highlights episode which by the way is going to be a big episode and look at this um on the 7th when I ran it let me get my pen out here so you can see what I'm clicking on or what I'm pointing at on the 7th when I ran it it was 106 B batches right these are batches of 50 and you can see all before that that's what normal batch size looks like and I was like okay something's wrong um so I was able to fix it I got it down back down to 52 today but let's take a look with what happened um one of the things that I do is I look at the site map for the service now store and I'll just refresh this to make sure this is still showing funky and it is and you can see what happened between this crawl and the last crawl is the sitemap generator I guess from service now is putting in this question uncore escaped uncore fragmentor equals in and what used to be there was an exclamation point and a pound sign or reverse order a pound sign and exclamation point I can't remember which way you'll see it here in a second in my transform so I had to do a transform to say hey if you see this replace it with what's supposed to be there on the URL because you can't actually get to these so let's just go ahead and uh highlight that and we will go to that in a new window or new tab and notice it goes somewhere weird but if I just go ahead and replace you can't see what I'm doing because it's hidden right now but if I just put an exclamation point or a hashtag on the exclamation point it takes me to the actual application like it's supposed to so here's how I fixed it um back in my instance I went to the transform app which um yeah the transform map which is right here transform maps and I have one for for my site map I have two site Maps I look at one is the doc site release note pages and one is the service now store and on the field for location when you're looking at that in the sitemap crawler it's this loc um in Brackets there or in the XML uh LLC and/ LLC is what I'm looking for so if we go to that sitemap I'm going to go to the source field right now it says script before it said l OC and what I did is I checked this box to use Source script and it was really super easy again it's my first time doing it um basically I set a new variable called location and set it to the source _ location which is how that comes in and I said hey go ahead and replace that question mark underscore escaped underscore fragment uncore equals with this pound exclamation point and then return that for the Target and that's what goes in the actual table so that fixed my issue I was able to run my import and transform and do the crawling and everything worked great but I finally got to use a transform script for the first time ever in all these years I've been using service now and it's that simple it didn't take less I mean this was less than probably 10 minutes of work to fix something that was completely broken basically it reproduced every single app in my application listing because it had a new URL and I used that for the UN ID so anyways 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 trying out their first transform script on a transform appap and until next time don't forget to always be [Music] [Music] learning

View original source

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