TechNow Ep 54 | Save Time and Headaches with ServiceNow's Script Debugger

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now stop further delay I like turn today's call over to your first speaker Chuck Tomasi Chuck you have the floor thank you very much Marvin and hello and welcome to another episode of tech now I am Chuck Tomasi joining me today we have Craig step and a new voice you will hear very happy to introduce Stacey Bailey will do our introductions in just a moment our topic today is of course the ServiceNow script debugger and how it can help you be a more effective developer and save time and headaches and as a developer that's what what is a quick quick rephrase afore not to do the intro tech now is the web series for ServiceNow developers and administrators on all aspects of the now platform so college if you're in the wrong classroom if you're welcome to stay make sure that you get the right place and you do understand who were talking to and why my name is Chuck debauchee as I mentioned real quick introduction I'm a senior TPM M with a whole lot of IT experience pretty much my entire career has been based around some form of IT experience that a customer for a couple of years for service now before joining the company in 2010 just past my eighth year anniversary last month very happy about that and worked with a bunch of wonderful people that keep this going you can also find me on live coding happy on we did a show last Friday really exciting stuff over there about the REST API is there not going to get into that here today and you can also find me on the community livestream each Monday through Friday at 1 p.m. UTC I now offer the slides to Craig step to do his introduction yeah and there's a beautiful picture of me and my dog on the one on the left of the picture just to let everybody know I'm a senior curriculum developer it serves now I've been here for closing in on the five-year mark getting there almost there I love it every minute of it there's always something you know new to figure out or use in within ServiceNow it's this has been a fun challenge again I've been here for about four years I handle all the instance infrastructure so if you take it any the classes that we offer at ServiceNow any of the labs if you met if you've been acknowledged than any of those labs you'll see through my handiwork on the back end facilitating some of all the curricular developers to be able to build these labs and instructors that you see at knowledge so that's what I do and as always my hobbies are still podcasting photography and Linux not necessarily in that order I'll turn it over to Stevie hi everyone I am one of those curriculum developers that Craig enables and I'm very excited to be joining you for my first check now I've been in the IT industry for quite a number of years quite a number of roles but I've been absolutely in love with the ServiceNow platform for the last nine years first as a customer in an MSP so domain separation kind of role there then as a partner and then finally got up to the mothership in 2014 I personally am a foster parent which takes a lot of my time and then I am also a sucker for any kind of new technology gadget home automation CAD 3d printing anything goes if it's got an on-off button and has code I love it how long that that's awesome you're in good company Stacey yeah who we picked that we picked the right person for this show total nerd and the token female right Stacey was actually the person who did my domain separation class about four years ago so yeah she knows her stuff and that was kind of what led us to that DISA quit run down to the agenda we do up some preliminaries to get through we are going to cover a quick tip the agenda says I'm going to do it that is all Stacey is going to do the quick tip and then we'll get on with the main topic about the script debugger one quick note if you are entering questions into the Q&A widget on on the service the last couple of these that we did were a rude awakening experience of how many questions we got it was very good for us to keep up I encouraged the questions but don't be insulted if we don't get to your question on the show we could probably make a full hour or two just under the Q&A we will be posting this to the community on the technology side that goes with the video of the Q&A at the full description so you can find that on the community will give you another reminder and a link at the end of the show so I enjoy credit yes just a quick note don't you post the questions along with the person's email address that I after their kind of a little name it will say any of our duplicates I really duplicate them so don't be insulted about that the it will say your question your name the answer and who answered it so you will get cranker Stacy or myself right all right well we're good and you know I alluded to earlier that I do a lot of work on the backend of the knowledge conference which is where I was going with that where we must have both hit slide there we go so if you haven't been to the knowledge conference at all up until now please make time together next year it's May 6th through the 9th it's in Las Vegas once again and it is a lot of fun sometimes it's like drinking from the fire hose because it's a lot going on but it's so well with it especially if you're within the ServiceNow ecosystem there's lots of labs there's lots of people to network with maybe a lot of people you know or maybe some people that you need to you know would be interested in meeting there's a lot going on so if you're ready to surf now at all and I imagine you are because you're on this this call this is a place to go so nail to make now's the time and again it's May 639 I know Chuck will be there Stacy be there I'll be there and actually staking out are there during pre-con which is something you may want to look at you because that's when we offer some of our our our normal training classes that we offer early on before the actual conference starts so you can get a head start on everybody at the company you may be you may be asking yourself why are we talking about this ten months ahead of time because this is the type of take your 2019 patients we're talking yeah we're talking about ten months ahead of time because we have to talk about it same with a job you can get in and issue reservation sir right so if yeah it's fantastic event and I've I've gotten a lot out of it myself even being on the back end and sit in on a couple classes and stuff and it's just good to be around everybody face to face rather than you know face an email interface so all right motivation translators will go to safety into next year those avatars obviously online into real people make you call that me Spade right all right also based on some feedback that Chuck shared earlier we wanted to take a look at the customer Success Center this was something that John Donahoe launched at knowledge 18 in Las Vegas and there's a lot of really really good information over the past decade or so ServiceNow has developed many many communication channels such as the high server for technical support the wiki and then Doc's for product documentation and community that's expanded greatly over the past couple years to include the developer portal YouTube channels training and certification etc so even for those of us who have been around the platform for a number of years you know we can kind of keep pace with it but it becomes fairly overwhelming for people new to the platform so the customer Success Center was launched as a way to curate content from all of these different channels align them along business journey so in here you'll see plan deploy optimize and extend everything in the customer service portal is based upon what business goals customers are trying to achieve it goes well beyond what buttons to click and includes prescriptive guidance in a very easy to digest plain language format so you don't have to know ServiceNow terminology to really understand this and drive from the business your turn goal that you're trying to achieve down to the hard core technical content so this content is curated and updated on a regular basis you can see we're soliciting content right here in this month you can drill down into a number of individual product lines use cases industries etc are there good good customer stories there are also calculators to anticipate the ROI of implementing particular solutions based on your current environment one of the things that came up in a previous tech now was upgrades as well if we drill down into platform overview you can see a lot of really good information in here about about the platform how to achieve success with it but you can also get into prescriptive guidance for upgrading the platform and for maintaining it and tuning it on a regular basis one of the things that I find very useful as well in cloud infrastructure here we see a lot of really good information about service miles non-stop cloud architecture compliance and security authorizations data centers and then we've got featured content there are many white papers and ebooks here that you can download and I consider this required reading for anybody getting into ServiceNow talks about our data security authentication methods encryption options platform availability high availability security testing how to do customer penetration testing so this is just packed full with information that anybody who dives deeply into ServiceNow from a developer architect or platform owner perspective absolutely needs to know and like I said there there's a lot of good information it's constantly curated and updated so check it out and check awesome there's also in explore trends and perspectives where we've curated industry articles that are very relevant as we dive into machine learning and artificial intelligence and the future of computing in general so again check out the customer Success Center the URL for it of course is just gww service nel comm slash success so it's very easy to find moving on to our community quick tip for the day our quick tip for today is adding the description field for business rules and there's actually a quote that I've heard many times over the year as a developer always code as if the guy who ends up maintaining your code is a violent sociopath who knows where you live so you you have a source on that author unknown of course there are two guys that this might be attributed to but I couldn't find any definitive source but I think it goes well as a life lesson you know not only a code smart comment your code and make it easy to find one of the other things that I always like to say too is if you have an issue you want to be able to call high support and have the person on the other end of the phone be able to immediately understand what you've done in the platform any customizations that you've run so that they can zero in on the problem and help you get back in business as quickly as possible so one way of helping out your psychopathic successor as well as tech support is to add the description to the business rule field and this is something that you can do for lots of different things here as we just roll through the business rules you see there are over 3,000 in here and I don't have a lot of plugins enabled here sometimes the name is helpful sometimes not since this is the first time I am joining here I am going to pick on Chuck but just to open up one of these business rules we can see you know you can kind of see what the name is and then you have to kind of parse the code to understand what's going on and cross your fingers that people have commented it one of the nice things that we can do is add that description field so for example I was digging into Chuck's application to manage this podcast you've got two business rules in here one says set quick tips feet and I actually had to use the script debugger to truly understand what this business rule is doing so I'm going to show you something that we can do very easily it is a customization to the form which means that you will not inherit updates on an upgrade but the risk of doing this is very minimal so on the business rule form I'm actually in global since this form is managed in global I should be doing this within an update set but I can right click configure form design wait for that to load and there already is a description field on the business rule table so I can add a new section I'm going to say this is one column instead of two and I don't really want a title on there from there just drag and drop the description field which became filter conditions let it go let me refresh that getting to happy alright because you're picking on my application yeah okay we're going to erase the section name I won't click as quickly drag description filter conditions that's weird that's crazy hey try adding it breaking Oh plan B form layout plan B yep you got it alright so form design is new form layout is the old tried and true thing and there's our description field already in there one designer has issues ah I got shy now I gotcha I am in the scope okay so now we've got we've got this description field in here it's on the default view so if I go into Chuck's application again here I should see that in an editable format and now that I've used the script debugger to really understand what this does I'm going to put a good description in here to explain what this does and now as I'm looking at the business rules just in a ListView I can then take a look at and quickly understand what that does so I've got the ListView here the description government show I could personalize it and show that here but if we're looking to help our successors and other developers understand what we've done personalizing this for an individual probably the best way we'd want to right click and configure the list layout instead so the pros of doing this again are that you can help your successors and other ones it is a customization but if we imagine the types of customizations that we do to the platform in a pyramid the lowest level being the lowest risk this is definitely a low risk we're not going to risk a compromised system integrity on an update or upgrade rather because we've added this description field on the other hand this will not automatically this one will not automatically inherit changes to the form layout when we do an upgrade however if we go back into our configure form layout this is something that we can easily revert back on form layout if I can move my on 24 screen sharing we have a related link at the bottom to show versions and I could see my changes but then I can see here's my London update right click and I can revert to that version if I wanted to get rid of it and go back to my baseline capability so again form layout form design add that maybe customize your list you and then if you want to also the view that you get when you hover over the reference icon this is called your sis pop-up view and it may be helpful to have the description right there as well so that you don't have to scroll through this interface yeah yes I agree with that so just this form actually already has a pop-up already enabled but you can manipulate the URL and add your own system for tables that don't have assist pop-up view so yeah I would I would definitely do this for both the default view and just pop up that way you can kind of preview if it's not in the ListView good point I hadn't thought of the SIS pop-up going thank you yeah it seemed like and may seem like a trivial thing to do is like why why doesn't service enough with the description field on there itself it's on pretty much every other field that has a comment or description I been asking this of our developers for at least five years and it hasn't come along yet so I would reduce that risk even more that in the future I'm glad you showed us the revert option as well to go back into the versions Thank You Stacy um I am going to have to release screen controls we can go back to the Sinai's thank you alright so let's get on with the script debugger safety mentioned this as she was going through that as she was lambasted my horrible coding practices but now that we had the description dealer field on all instance on our application to manage this show I feel obligated to use it now I'm definitely going to get in that practice thank you for underscoring the importance of that so that my future psychopathic self it doesn't go all ape on you and because I'm usually the victim of my own coding practices we are we talking about yes we are I don't know if anybody else ever going to maintain the technology bugger came out of the Istanbul so that is about eighteen months prior to when this is being recorded the Istanbul came out at early 2017 and it's one of those underappreciated features that came out in the platform a few things you can do with it I'm not going to read this slide bullet for bullet you're all intelligent grown-ups I assume you can read and it allows you to take a server-side script that's running interactively like a business rule or UI action whisper pollute and make the system stop at a particular line we call that a breakpoint so you're going to be running through your test process as a boom it just stopped I did a quick demo of this on the community live stream just an hour or so ago and it was it was very encouraging to see that yes it still works the way I expect it to so it allows you to get that control and prior to the scripting debugger we would often have to put in debug statements GS debug GS print GS info whatever whatever those outputs were and then run to the log see if we got our desired out like this accelerates that process because you can stop the code and walk through it now it doesn't stop it for everybody if anybody else is on the system and they're running your business rule fine it'll run for them whether it works or properly or not let's get the essentials out of the way I do like to mention this this is we added recently it is available in Istanbul and later so we can stop with your Q&A in there with recovered questions the price no additional cost for the debugger it's part of the platform it does require a plugin which is generally activated on all instances but if for some reason you don't see the debugger there's your information of go to system definition plugins look for that particular plug-in and you can activate it it's it's been turned on automatically for anyone upgrading to Istanbul or later and it's available in all new instances and there should be any reason why you're not there it does require either the admin or script underscore debugger role to use this which no surprise you don't want your end-users running scripts okay it does run on server side scripts only that means it's not going to work on your clients purchase when it work on scripts in UI policies it's not going to run anything that's not interactive including workflows Interactive means somebody's at the keyboard he's running a browser somebody sees this in real time or close run in the background scheduled jobs run in the background so you will be able to debug the scheduled job got an alternative for that if you're interested reach out to me we can do that script includes has an asterisk nearby it and unfortunately I didn't put an asterisk to explain what that was a product the bottom I just noticed that but it is for server-side scripts you can do client-side scripting sorry you you you cannot do debugging on client scripts called from Ajax if you structure this properly your client scripts will call a server script and then your client excuse me a quiet script will doing line ajax call to this client client-side script include I go say this right make sure you get it and then I heard you're okay yeah I'm hurting myself really and here that that Ajax script include will then call a server script influence another layer of abstraction but it allows you to do that debugging that way so just want to call that out where it reaches and where it does I didn't have a question in the live stream this morning does it work on service portal widgets you cannot set breakpoints in the widget editor however you can set it on the widget forum that being said I did a test and I was not able to get it to stop at that break point so there might be something going on in the background a detachment of what is the current session is it interactive that kind of a with service portal so at this point the answer is no script debugger on the server component of a service portal widget I got to talk slower I really hurt myself I want to go into a demo real quick let me do the screen share get this up here because you all came here to see the actual service happen not just talk about it this is little things that's far more interesting dancing only will be yeah I'm dancing I'm dancing you keep an eye on the QA my new skater who came from our community and somebody said hey I need to extend the number system of my table I accidentally made it 5 and they needed seven eight seven I need nine digits of precision well if you go to the table definition will go there with configure table and you realize your mistake and say under the table definition there's control you say great let's change this to seven well that's all fine and dandy for new records new records will come out with the proper amount of numbers but existing records still have their old numbering mechanism this happened to be when I was a customer let me start out with five or six is six and they need to go to seven nine or whatever it was I needed to increase this and I said well how do I get these existing records to say ve m zero zero one zero zero four I need a couple of leading zeros in there these are strings the number field is a string and it's automatically generated when you create a new record as evidence by this see number 13 is going to get us a new record with the proper numbering we can create this new record water on the floor you'll see my crazy naming activism here and there's my new record but being the older ones are not updated so I said I know I will create a script and renumber this I expose it in the UI action for demo purposes normally you run this once and it's done whether you do that with a fixed rim or background script doesn't matter but I hit renumber and it immediately says you have a problem and this one's pretty easy to fix apparently somewhere I said renumber I spelled number wrong the name of the field is incorrect so if I go into studio and take a look at the renumber UI action that's that red button at the top and it calls a script look at me I didn't put comments in there again shame on me for this demo it calls a script include called renumber and then the renumber just says run it has a function in there called run passes the table name and a field name and oops that's an easy problem to fix I didn't need a debugger for that I update that save it try it again you know what just for you know I hate renumber and it says object records renumber what happened whoa that's a terrible renumbering scheme and just for grins that's my new record so it's really making a mockery of that let's go back to my original data set here do this again I'll show you what happened it said undefined de m something is broken in here and I don't know what it is now I could start going into my script include that the UI action is calling and go oh man this is kind of a mess what Oh whew yeah and do what Stacey did and run the script debugger and step through it step by step I want to know what's going on in here so I am going to set a breakpoint we already did this once but all I have to do to do that and say hey script debugger stop right here I'm going to put it on the first line and just click the line number you see I get that blue tag I could have multiples in case I'm inside of an if statement I want to see if that if stadiums trigger I can put it there what you don't want to do is put it on a comment because the price point doesn't run comments it just skips right over it the debugger goes now that's nice so now that I've got my breakpoints yet I want to tell the script debugger script debugger can be found underneath system Diagnostics script debugger I happen to favorite it it's one of my favorite things so that I have it on my favorites over here and I bring it up and it brings up this other window and says yep I'm just going to sit here hang out be happy with watching for these breakpoints you happen to have only one at the moment it's in the script include called renumber alight Rachel wow it's so smart it knows what I did and I need to fix this let's go back to my renumber this go back to my original data set again I'm going to try and find that now that I have a breakpoint set and the script debugger out here in the open I'm gonna make that a little larger so we can see open goodness that it brings to us I'm going to hit renumber and it goes hey I hate your breakpoint let's start debugging click the blue button and it says there's where you told me to stop I'm happily waiting for you right here this is your script include this is where you told me to stop over on the right I have all of my variables digits which was passed in as a as a parameter to this function table mate that's the table I'm going to renumber etc etc I even have a test argument here that says true and what test does is it only remembers one record good standard practice if you're testing things out and you don't know if they're working or not don't run it across all your records run it across a small subset in this case one and I do that with a glide record query that you'll see in a minute now over on the left is a little more technical information I don't glance over here as much on a personal basis but I can see this back of how this was set up UI action is calling the script include if I really went in-depth I could trace this down even further I obviously have my break points over there and I have the details about this transaction I was called the URL all kinds of different things that are going on that might help me debug this even further but again I rarely use this information if you want to dig into that have at it it's not the focus of what I wanted to do today identify but I would it is good insight yeah and and you know support me use it as a method to the controls for walking through the code are up here I have pause to pause the debugging in case it was running away I don't know I've got resume which will run to the next breakpoint I only have one breakpoint so hitting this play button at this point would you say go ahead finish the job which sort of defeats the purpose of the stopping I want to analyze what's going on how does he have this crazy problem going on with nightly numbering algorithm I've got step over and these are all associated with hotkeys and then will come up this and says option f9 will do this but step over says when you get to a function call if it's something that I can drill into and the something being is it is it in a script include is it in this particulars concert is it JavaScript that you have access to see and run then it will go it will it will not drill into that function that's the difference between these two right here this is step into then go into this function watch it run what are the variables of that function how are they doing I want to analyze this step by step but if you've already unit tested that function and you've got confidence that it's working the way it should you can step over it to save yourself some time otherwise you can find yourself going down this recursion of this function calls that going into that function step step step this function calls another function and you can find yourself six seven levels deep without any great value it's just time consuming at that point oh what am i over going home to level one and then if you're done you can step out of the current function I in this case want to step into if there is no function either of these two will do the same thing your going to the next line so I should see run cast as a boolean B set here and there's run cast and I'll set to true and stepping into and stepping over do exactly the same thing here it sets a message in an array that's what I use for my error messages so if I don't have a table name I'm going to error out and the quickest way to do that is push something in the array a little later I check and see if the array is greater than one if they do here if I does error out I get a whole litany of what was wrong I'm there forgot multiple arguments whatever it happens so just debugging my own script to make sure that the person is using this function correctly let's go down here I got a table name I got a field name I've got digits so it's not going into the if statement obviously the digits are greater than zero right so I I said I want to it wouldn't make much sense to say hey and my I prefix is dm-100 four that's four digits let's make it - three digits that's an invalid value so I need to check for some of this stuff now here is a function call prefix equals this underscore get prefix I'm going into the the number management table the number maintenance such as number maintenance table where tables keep track of their numbers when you saw me going to that table definition and change it from four to seven earlier that's actually updating a record in number maintenance can be found under system definition number maintenance and if I look at what was updated recently I can see that my demo record has been updated this is the prefix and I want to strip that off and understand it as a separate component so I can get my hands on the number and then add the number that's my algorithm here is I'm taking the existing string breaking the string the DM prefix from the actual number okay back to the debugger I want to step into this function and it says pass me the table name and I'll take care of the rest I'll tell you what the prefix was it goes in here and it says go get a glide record on the maintenance table and maintenance table I defined up on top this number that looks good again I can keep an eye on what these variables are doing on the side over here so I should have a gr instantiated tada there it is and I do a query to say we'll get the record where the table is the table name and it says for every record you find and then I notice it's skipped right over that it never got the prefix something's wrong here which is why this function is returning and undefined into the prefix variable I go to the next statement it'll show me that the prefix is undefined that's why it came back as undefined EEM 1004 ha ha I think I've got a line on this something's wrong with that query the debugger has helped me find out I don't have a whole bunch of debug statements in here here's the value of this and why is it undefined and you run it over and over and over so if I go to my script include the actual factual script and code because I go to get prefix this seems right we know Craig you see anything wrong with that query statement but that query statement mm-hmm looks fine to me why didn't it get a writer okay the reason is very subtle I drill into this record there's the table field labels are not the same as so things absolutely this happens in the dictionary - you may find it in Sanko field it's called element is not called yeah a lot of time I will say a lot of times this will happen if you have a form that represents fields from two different tables you know so uh you know who knows what they named it oh yeah this happens when I'm scripting I just go okay I want the table the prefix the number field and you start going hold then then you don't trust yourself okay prefixes prefix number is number so why is table category I don't know go back and ask Fred Lunney from two thousand four or five it'll tell you right but it also tells me that all I need to do is change this to category save that and let's continue running this it's going to run my bad use case which I will go and fix my datasource t-150 for my original data it's still bad because I finished a bad pun I knew that was going to happen fix this up and let's try renumber again you want to start debugging sure why not in this case let's go run and I probably should have moved my breakpoint a little bit down to solve this problem no problem there they get my prefix I got my prefix I walked right over it they didn't see now my prefix is actually de M that means this part down here can make sense of when it's processing the record and it says you place the prefix with nothing now get the digits and tab them and put the prefix back off this code is going to run exactly as I expect there is one other thing that I should probably do to prevent myself from that happen again and that would be oh look it works I've got seven digits of padding not according to the system Bert able which would have been a better place to get it but it's actually according to my renumber UI action which said I want seven digits of precision right there oops I deleted it and then put back so that's that's who is driving the number of digits would have made more sense to say hey what does this number say I should get it from the four not where I was go the safeguard against anybody messing with that again would be to go into my script include and where I get the prefix there's my prefix this prefix would be to add a little code in here to say look if a number wasn't found I'm going to do the error unable to look up prefix for table Allah and that would steer me in the direction go you know what I better look something is really ask you here either is this number table is whacked by script is whacked something's not working so anytime you believe you have a value I want to double check it that's just good coding practice right there all right so again no no issues with that I do have one other use case and I was saving this just in case we have time and we do you remove that breakpoint I have a UI action on that same form hey by the way almost like it so we had one question and I was current remember this so but if you're looking at the script debugger and say you have some breakpoint breakpoint as you set can you remove them from here or do you have to go back to the original script to remove them I don't believe so but let's find out let's go to my script include and that's not descriptive clear that I'm after this is the script include someone wave their Jedi hands in front of my face this is not the script up is do include you're looking for right and I place a breakpoint there this pretty bugger recognizes it just ends up it registers in the breakpoint you want to know can you turn it off here it says yes what I noticed is it's still here now okay yeah right we load the form is just so on 48 it is not okay yes you can control them there that'd be happy hate if you have several breakpoints in several different scripts and you're they're all related or something exactly or you're doing you're like I did a minute ago I said you know I really should should have moved breakpoint button that just move it there that that would have been a better way to do and I think that we had out before we move along one more thing was I've seen several people ask and think about the obvious questions answer is yes but can you use the script debugger for global stuff or only scope taps or what global or scope doesn't matter yeah I ran this this morning in a demo on the one of the business rules on the incident table for setting a resolved state and I said let's put a breakpoint there and see what happens and it would stop no problem but you definitely want to be in the scope that you're using to debug but excellent question thank you and I have one more quick question I don't know if it's quick IRA but if it's not you won't push it off to the replying after the show but if you had a catalog item that calls a workflow and the workflow calls maybe some script includes with those get debug - I know in the workflow I don't think it big bugs like actions but if you call a a script include maybe my understanding is no because the script includes just a library and it's being used by the workflow which is happening in the background so I can get a look at it but my my instinct right now is now I think it has to be running in your as a current user or something right yeah yeah I am just going to turn the test mode on this UI action off and show you that it will do exactly what I want it won't affect number 1004 I run it and did I save that I saved it really I didn't test it test mode is false should have got all the records let's do it again object object record three number that's a terrible output message all right we'll figure out the rest of that we numbering code is later on to the second use case sorry for all the flipping back and forth they're in here I have the ability to take one of these demo issues glassing the driveway and send it to IT let's say for whatever that's an IT issue and my UI action I look over in studio is all encapsulated in the script it does not include a script include now if I run the script it's going to create a new incident on the incident table prefixed with demo with demo and the short description from the demo record also carry over the assigned to place that in the caller ID and the description becomes the description so I'm taking three values from one record to another great example of the value of ServiceNow all being on one platform we're not writing any crazy integration between my IT system and my safety system and my legal system is all on one I can just create a quick UI action then I display a message then I'm going to update the current record so that the comments and the state are set to close I don't know if you're real sharp eye you may have recognized something the issue with this whole process I'll demonstrate it I'd say I want to send this over to IT so I click that hey there's my incident it even took me there how lovely if the short description is correct the caller is Craig because it was assigned to him the what else did we set the description field which I don't see on here we need another description we'll call Stacy she's good at putting description field on stuff the if I go back to my demo record at 1004 it's still open something's wrong with my UI action it's not finishing the job it's not closing the door behind it says look it's now an ID issue I don't care anymore in this table let's just close it something's wrong with that UI action so we know that this part works fine we're creating the incident let's get down to the meat and potatoes we'll set a breakpoint there for example okay let's try it again send to IT the script debugger says hey I hit a breakpoint you were doing something let's continue on I set the breakpoint and it stops right where I wanted on the message let's take a look at there's my in why'd record that it created you know that work so I don't really need that the message is going to be created here haaaah incident created that's what it displayed at the top of the screen when it runs line eleven then we get to line fourteen oh and by the way meant to say this if I look at system logs I have a GS info statement in there that says the state was updated look in the system logs it says look I sent this to IT and the current state is seven which is closed so if the debug statement says it's closed why doesn't the record say that it's closed oh let's take a look with step by step here's here's update the record oh oh then it sets the comments and the state anybody see the issue with that logic reg must be off answering questions left unanswered questions I'm sorry go ahead I seize it what's the issue Stacy yes after you do the update it's too late to set the state in the comments exactly I might have had you know the cat jump on my lap and interrupt me whatever I was doing when I was coding at first glance it looks pretty logical but then when you get past it as she said I said the update and then I set some fields that's backwards that's not what I want it's going over there I still work this is on the right order it's no it doesn't work as the end result is wrong and what are even betterment of using is my info statement is saying invalid information so in this case debug statements are not helping me at all it says oh yeah it turned out stages seven not according to the database it's not so let's continue on with that we'll do one more invalid run go back to our UI action and do two things one move this works supposed to be set the common set the state set the then we update the record and you know what this is a do me any good I don't even want it I've got the script debugger to tell me life is good let's go on and of course when we go back to our demo record in 54 we're going to find number 1004 still open from that second attempt attempt number three we hit send to IT you want to start debugging I probably should have turned the breakpoint off but okay let's whatever let's just hit play I'm done so I will take a break point out of that it says incident was created again I've got Craig I've got the short description life is good go back to my demo record and 1004 is now closed so the debuggers not only helped me understand logic that was happening but it also debunked some false information on the on the screen in the logs GS info is not being too kind to me all right that is the end of my demo I'm going to wrap this up with e takeaways thank you very much for watching by the way if you made it this far the descriptive letter is really there to save you time and of course money breakpoints are persistent as we saw they will stay if I save this application log on come back tomorrow breakpoints will still be there until somebody removes those breakpoints so if Craig was running and he didn't have the debugger up it doesn't matter if the breakpoints are there or not it's just going to seamlessly run you have to have the debugger on the screen and the breakpoints set for the debugger to actually kick into gear and it works on those interactive server scripts and according to that table before and the evidence that we saw some reference information that I encourage you to look at we've got our doc site which goes into this debugger in great detail we've got wonderful information over the ServiceNow community the developer site if you want to get started and grab a personal developer instance I encourage you to do that free personal developer instance you can run Istanbul Jakarta or Kingston try out new features turn on plugins test things out outside of your own development environment so if you're just doing a proof concept and things go sideways you can always wipe them restart or throw it away and claim another instance doesn't matter encourage you to do that and again getting back to last month's comments people were asking for content that we've already covered in previous episodes we've been doing this show since early 2013 with over 50 episodes there's a lot of great content people say hey can you talk about script includes yep already done that ok talk about ATF already done that service portal yeah already done that a number of times so I encourage you to watch that this also has as we get closer to the next episode in August we'll be on the London platform feature so very very much looking forward to regrouping with the team we'll have a special guest with us and getting to that so you don't want to bookmark that keep it in your history all of the code is available that I've shown on here from github the complete application with the demo records in it if you wanted to look at that last link and again and where can they finally get to what the the code at that github link at the bottom okay so the T and 54 dot get on my personal account so I saved that exact application with the demo data and the bugs I want you to find those bugs and fix them test them you can go through the exact same steps that I just did over at that github account if we didn't get to your QA we will be posting that to the community that in the ServiceNow tech now link will take you there as well so again thank you for joining us joining us on behalf of Craig and Stacey I thank you again and look forward to seeing you either in real life at a developer meetup or on the next Tech now the community live stream we do so of your interaction thank you very much for joining us you
Info
Channel: ServiceNow - Now Community
Views: 4,874
Rating: 4.9298244 out of 5
Keywords:
Id: 8cMxVZMz5CA
Channel Id: undefined
Length: 53min 38sec (3218 seconds)
Published: Wed Jul 18 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.