Community Live Stream - Code Decoded - Script actions
[Music] good morning good afternoon good evening wherever you are and whenever you are welcome to the community live stream my name is chuck tomasi senior developer evangelist at servicenow and this is august 31st 2020 and our topic today is script actions i'll get to that in just a moment first a reminder that we do this show mondays and thursdays at 2 p.m utc so that's currently what the 10 a.m eastern time 6 30 p.m ist no 7 30 p.m ist i'll get it it's it's actually written down here just off screen i should have it memorized but yeah you all change your clocks and it makes me confused so i don't and it's 2 pm utc so if you have to do the math go ahead and hit share like helpful subscribe i think the alert has already gone out let me look yeah there's the twitch and youtube alert messing with my green screen but we've got those and apparently he's telling me to update my voicemail messages which is odd i shouldn't do that at 7am when i'm starting this at 7am so we'll move on you know what to do on youtube share your comments there in the comments hit the like so people can understand if this has something useful in there everybody's joining up thank you very much it is a wonderful group in the chat today had a had a nice pre-show chat so some of you showed up early and just some well wishes and good luck kid thank you very much i appreciate it the broadcast is also done on twitch twitch.tv now community if you happen to go over there that one's around for a couple of weeks you can use it as a backup plan in case something happens with youtube but fingers crossed that the internet deities are with us today we'll soldier on 7 30 ist ganesh tells me thank you for confirming that if you've got questions that go beyond today's topic of script actions okay please i invite you to post them in the community that is the place to get your crowd-sourced support if you're not going to our regular customer support then this is a great place to bounce ideas and say hey this is what i'm thinking of or i'm trying this and i ran into that be sure to do the needful and post good details about what it is you're trying to do not just technically but functionally what is the objective because you know i've often gone down path a and somebody says well you know if you're trying to do x path b might be a better approach i'm like oh you're so right and that would just change my head around so as you're posting pictures are great idea if you can put in a screenshot it's worth a thousand words of what you're doing i had i had a support case this weekend and it turned out to be something silly that i should have caught it was it was something that i learned 12 years ago but thank you for somebody every once in a while you need somebody to remind you that even the easy ones can get by the pros good morning everybody let's continue on you know so community please keep your questions if you've got questions or tips this is a a dialogue with the chat the live chat if you're around doing that put your comments in there i may be missing something or i may say hey you know what i never did figure this out if you figured it out please let me know it's a wonderful thing this is a live community this is a piece of the community and we'll be posted back to community.servicenow.com with all of the links and show notes in fact i think it's up there right now i'm just going to uh tweak it a little bit after the show we will have some clips in there if you are interested in becoming a developer or want to grow your developer skills by all means go over to developer.servicenow.com get a free personal developer instance running the latest release of paris which is still as of this video at least for a couple more weeks still in early access so you could be one of the first people to take a look at paris and unlock its features and discover and go through the release notes and learn all there is to know about the paris release it's good got some cobwebs to clear out this morning uh we also have the scripting apis i'll take a look at that this morning we've got learning plans we've got blog entries there are events so if you're looking for what's coming up in the developer ecosystem developer developer.servicenow.com is the place to go wonderful place lots of great content continues to change do check that out the other thing to check out on there is some of the meetups that are happening we've had a few last week i think we've got another one or two this week over at meetup.com pro servicenow dev program a lot of these in fact all of them right now i believe are happening virtually please if you are considering having a meet-up do it virtually until we get out of this whole covid situation we don't want any of our precious developers to get sick or get others sick so do that over at meetup.com there's always something happening i know there's a couple like three of them coming up in india in the next couple of weeks so check that out a lot of great uh ideas being shared on those uh meetups over at meetup.com pro servicenow dev program these are developers talking about developer topics to other developers so hey what more can you wish for right that's a a great thing if you have developed an application please be sure to tell us about it over at bitly slash tell us about your app and we will donate fifty dollars per app up to five apps to the uncoved recovery and relief fund that you see there it could be a handy utility for other developers it could be something that's running your entire enterprise we'd love to hear about this and help out those who have been dealing with the covid situation go over to that link takes just a few minutes let us know what you built if you haven't already been listening the breakpoint podcast had a special episode last week it was the content from the webinar i did with david liu yeah that david liu from not just the demo data but he is a real person who helped write some of the earliest code i think it was employee number two or three or four it was fred luddy beaurageri don goodliff and david liu were like our founding forefathers you can almost picture them on mount rushmore if you will instead of the four presidents we should have a mount rushmore of service anyway i'm getting off track the breakpoint podcast comes out every other wednesday our regularly scheduled one for this wednesday in just a couple of days if you haven't already subscribed over at bitly slash sn breakdash point you can find it on your favorite podcast directories as well apple google spotify you get the idea stitcher tune in there's a whole bunch of directories out there that have it if you if whatever your podcast or you can do the brute force thing like a lot of developers and just type in the rss url and be done with it i think that's what i did before it got on any of those directories just to test it so this wednesday we're going to be talking with wolf wedimeier about building now experience components sort of the behind the scenes look at the tech now we did a couple of weeks ago so he was gracious enough to give us his time on tech now to show us how to build the components now we're getting more into conversational dialogue about hey what skills are needed and some of the things we didn't have time to ask on tech now we're going to be doing that quite a bit getting our tech now host on to break point and having a discussion and then there's some other stuff coming up in september and october and oh we've got such a great schedule in fact i'll be recording another one this week go listen this is the servicenow developer podcast if you haven't already seen that speaking of tech now that is our monthly webinar series for servicenow admins builders developers all skill levels wide variety of platform topics and our platform topic this month is about the new features on upgrades in paris jivanjot will be joining us she is one of our product managers around upgrades and atf so we'll be doing that on the 15th that is uh just a couple of weeks away it's hard to believe that you know august is gone and i'm planning well into september and october for wonderful things to bring you look for that over at bitly tn79 reg go register get the reminder put it on your calendar it's going to be a wonderful session we have some really really cool stuff coming out around upgrades in paris if you haven't already seen she will be giving you the deep dive she's the person who knows so if you've got questions bring them we're going to have live q a on that we will be doing a little bit of scripting today i've pre-composed a few of these so you don't have to watch me type 20 or 30 lines of code we'll walk through it that code will be available for you to take download dissect rearrange practice do whatever you like put in your own table names over at the bitly link you see there it will have a dated folder with today's date i'll have that uploaded within minutes of the conclusion of this broadcast i don't have it there right now but well in real time if you're watching this you know in the year 2027 yeah it's still out there at least i hope it is is billy's still a thing i'm i'm playing time for mind games with myself this morning i don't know what no coffee kids this is this is just the way i am at 7am so go look for that code the the code from the previous episodes is also in that yeah if if we did code that day obviously if it was a you know something on form designer probably not going to find a folder with some code out there if you are new to javascript maybe you're an admin who needs to replace a developer maybe you're new to the now platform and you want to learn the esoteric things about how servicenow does this i invite you to go to bitly sn learn js there is a whole series about learning javascript from the start from the syntax from the variable names from commenting all the basic stuff you need to get started and then build your skills as you go up through complex objects and functions and looping and all of this is based around es5 ecmascript 5. no word yet boy when i hear about something about es6 i will definitely be able to share it with you i will let you know because that is one of the most common questions i get and i am relaying that to our development team about that so please no questions where's es6 i don't know yet and i'm i want it also so look for that over there and somebody just before the broadcast started ask me hey how's the progress going on the next video series well the next video series that i'm going to be doing is on integrations i'm it is a big topic and it's not coming out all uh at once netflix style it's going to be almost like seasons i'm going to be releasing this in blocks or parts or sections if you want that uh we'll the first one will be getting started the second block will come out shortly after around import sets and then we'll talk about web services and then we'll talk about integration hub so i'm going to have this there will be you know probably in that import sets probably 15 to 20 episodes so you'll have plenty of content but i didn't want to wait until all of them are done because a that would be a lot of content for you to digest b it might not be what you were looking for at that moment so we're going to learn we're going to grow we're going to do it a little bit different this time but still feed you that content so hopefully on a somewhat regular cadence maybe it's every four weeks maybe it's every six weeks maybe it's every eight weeks you get a new season of your favorite show so it will be similarly titled i suspect to this it would probably say learn integrations on the now platform and we'll go from there so i'm back let's get started with script actions oh yeah there's a lot of stuff to do and it's a lot of fun let me get to the there's my personal developer instance from developer.servicenow.com go get yourself a free pdi and get started quick overview of what we're going to be covering i have built and you may have seen this in previous episodes an application with some tiered tables if you're familiar with itsm we have requests and request items and service catalog tasks similar to that where you've got this parent-child parent relationship of three tables i used programs courses and tasks or to-do's whatever it was under there students i'm sorry students that could attend these courses well at a program level so we've got programs and programs are composed of sources excuse me courses i've got two two apps running in my head right now programs are composed of courses and courses have attendees or students underneath them each course can easily determine how many students there are in that related list but i'd like to roll up the student count of all of the courses to the program level and i don't want to do this while the person waits so the idea of that that's the data model the idea of script actions is they are triggered by events not itom events from some sort of system management application not events like birthdays and weddings these are system events that happen when somebody views a list or somebody impersonates a user or an email needs to be triggered these are system events and those events happen either by the system implicitly doing some action or one of your scripts creating or triggering one of those events what are they useful for processing stuff in the background just go trigger this event and pick it up and do it whenever you feel like it it's not imperative to my process flow great way of doing asynchronous processing we already have asynchronous processing a couple of different ways with business rules that run async would be one flows that run another but there are times when you need to react to a system event and right now we don't have a way to trigger a flow based on a system event unless you use a script action it's called the flow api but that's a different story all right so what i'm going to do is go through a couple of scenarios where i'm going to create an event in the first trigger that event and then run the script action so real quick rundown business rules run on database triggers a record was inserted a record was updated a record was created a record was deleted a record was read we've got these basic database operations the crud operations as we call them to trigger a business rule i really wish they were called database triggers instead of business rules it would have been a better more appropriate name but we didn't name them that somebody way back in david lu's time did that for us so business rules database trigger if you need something triggered manually you're probably already familiar with ui actions i've got an episode on that coming up just to get you the fundamentals and maybe some insights on that ui actions are the buttons are the links you see on forms and lists for example this menu down here is composed of ui actions this right-click menu has some ui actions in it those are manual triggers to go and do something script actions are event driven you may have put events to use with email triggers which is fine it's the way they used to be done in the old days before we had the condition builder and the table thing and all that good stuff but we are going to build ourselves a ui action excuse me a script action first now script actions are server codes so all of the wonderful stuff you get out of glide record operations is there the first thing we need to do is define the script i have built a script right here not too difficult to go through it says go get the programs for my program table that are active in order because there's an order field and for every one you find let's go get the related courses so for each program i'm going to get the list of courses and for each course i'm going to open up the table of attendees and do a count notice this is a glide aggregate because all i'm doing is counting to do a glide record here would be inefficient especially if i had hundreds of thousands of things to count it's so slow because it has to retrieve all of those records glide aggregate if you're just counting okay we'll talk about glide query another time it's coming up then i take that and add the course count to the program count program count was initiated way up here for each program it is an integer and notice that i am doing a parse int i don't trust whatever comes out of glide aggregate i don't trust whatever comes out of get value i want to ensure it's actually a number otherwise if it comes out as a string i'm going to get 3 plus 4 is going to say 34 because it's concatenating strings rather than adding the values so this adds things together i am going to do a gs info just to keep things visible to me and i'm not going to do the update yet i've got that commented out at this point i have a student count value on the program so i'm counting i'm like to do to skip past the course record to count up all the attendees per course that is my script let's test this where do i often test things over in scripps background test it there run it in the proper scope so that it knows things like constants.attendee if you didn't see that one that's another code decoded a little while ago and it says i found six in iff 21 in excuse me i found six in fleeing 15 so you can see the program counters going up 6 21 30 38 which is 6 plus 15 plus 9 plus 8. if i do my math real quick that sounds about right and zelp had 56 excuse me 56 attendees and 13 attendees which adds up to 69 and that is the total number that i can then put back into the program record okay so my script is running it's counting it's summing things up for each program that wasn't the hard part actually that was the hard part the easy part is take that script and now we're going to make a script action two things to watch out for okay first let's collapse all this go to server development and i don't think i have one in here e-tec program manager nope i okay so i've already built one this is what a pre-built one looks like almost like a cooking show what we're after i have a name i have an event i'm going to trigger off of and this list of event comes from the event registry now in this event registry are all of the out-of-box system-based events and if i create one it typically starts with a table name first okay problem task you get the idea or you underscore if you want to create one that way if it's a scoped one it's going to start with x underscore i don't have anything that says x under 66 238 under cc see cls 323 that's my scope so i need one i need to create an event so that i can create this the other thing is when you create a new script action it will default to active false i have run into this nearly every time i don't know what genius thought that a default value of false was a good idea but you may want to consider on your dev system changing the default value to true maybe maybe that's so it doesn't accidentally run in dev i don't know but i don't like that idea it just trips me up every time and it's been that way for quite some time and you think i'd learn after a while but some things are a little obtuse in my brain uh in my opinion one should call script include in a script action script actions are usually triggered on events they are they're always triggered on events maybe chuck can throw some more light on this so yes i'll be doing an architectural discussion soon too got that all mapped out got ready to go of where script includes go and script actions and business rules and rest apis and client scripts and client callable script includes it's all coming okay so i'm putting these these foundation pieces in place this would be a bit of a chunk of code to stick in a script action or ui action so i am going to if i were doing this for a production program i would create a script include and do that but just for the sake of here's some code i want to use it let's go and create our script action so it's under server development in studio if you're looking over here it's going to be under system definition i take that back it's under system policy because it's event driven system policy script actions or under studio it's right down here under server development i double click give it a name first check active so i don't get that stuck again and we'll call this uh program student count oh no i forgot to create my event i often do this out of order hard to remember to create the event first so let's go ahead and paste this in submit that and go and create the event so the event needs to be created in the event registry if you're looking in the platform ui it's going to be registry under system policy events registry there is another one under performance analytics which goes to the same place but this one just shows the pa ones it's got a predefined filter on it that's no big deal so i could either go there or in studio registry it's under server development event registration under event registration we will create one notice that it already has the scope suffix on it so i can name this as simple or as complex as i like i'm going to call it student count and it will put the suffix on there for me it's associated with the table program and that one and i'm not going to worry about the caller access fired by a description are helpful fields these are these are documentation okay fired by i'm going to eventually tie this to ui action account students and the description is run the script action to sum up students be a good admin be a good developer put these in not going to get too deep into events but i just need that event entry in there now the system event processing engine is aware of this if someone triggers an event that's not in there because you can trigger your events a couple of different ways i'll show you in just a second the most common way in script but if you if you were just to write a script and trigger an event that's not registered it's going to go okay i don't know what that is so you gotta have this in here i probably should have left that out so that i can copy and paste that action i need that for in a second now i need to refresh the form so that it refreshes that choice list we will do this x underscore there it is student count now this script is tied to that event anytime that event is triggered in the system it's going to say oh who's responsible who's reacting to that event it might be a notification or notifications it might be a script action it might be who knows so that's what we've got we've got an order here in case that event gets triggered and multiple multiple script actions need to react to it we can tell it which ones to run first so we'll do we won't do that got horrific documentation in here some nice comments let's go through and run it i'm going to update the value in the record now it's going to go through and do my two active records so i update that it is now live anytime that event comes across the system it's going to react to that and the way i do that is i'm going to copy that out back in scripts background make that a little bigger for you i'm going to say yes dot event q is the method we use to trigger that i give it the event name i give it the second parameter is a glide record well i don't actually have a glide record to pass this thing because it's going through all the records itself okay so i can put in null and then there are two event parameters that go on this they are both strings oftentimes you'll see something like gs.get user id and i will see in the log and have access to my script will have access to the uh the sys id of the person who triggered this script it could be a stringified json object it could be anything you want in these two strings it could be nothing so i'm going to just put in a scripts background test as one of them hello world as the other those are just two arbitrary parameters if you've got nothing better to that if you don't need them in your script put in the society and the date well the date's already in there let's run this what is some diagnostic thing so at least the log will make sense when i trigger that and go to the event log event log which is right there under system policy did i make that too small and we'll go with 150 for now event log i see there is my event it was triggered there's parameter one there's parameter two and it was processed and it took a whole 106 milliseconds it was processed that means the engine got it it saw it it recognized it and now it's time to say did our script actually run well remember i had a log statement in the system logs let's go to the system logs and there they are yay my counting seems to be working let's make sure that my program records are updated programs records let's put the student count on the list a little forward up front would be nice 38 69 these two are zero they're active but they just don't have any students on them and we know our counter is working what is the benefit of that well i might have something running somewhere in the system that says hey you know what it's time to update that just throw the event one little thing will trigger this whole script action very useful let's trigger it manually that'd be fun let's do from a ui action i could put that ui action on a form in this case i'm going to put it on the list i don't do these too often they're just kind of fun let's create a ui action so create ui action right click and just like a good developer give it a name update student account let's give it the table it's going to appear on the program problem program there it is program table it's going to be a list banner button and i like to give these cls count student i like to give them an action name i'll tell you why when i get to the ui actions episode we don't really care about insert and update because it's a list not really making much of a difference there let's make this big and green so that we see it or whatever your primary color is comments count the students put in your comments and description fields kids i don't need a condition well maybe i do want a condition like gs.has role admin or cls admin or something do i want this to appear for everyone to just whack that button and all i need in here is my same statement i had before which was handy dandy over here copy paste and away we go now this will be ui action world submit that and when i go back to my programs list i should have a nice big green button up here that says update student count click it says no record selected oh no okay there is a trick to work around that i'm just going to do that and it sent the event did the processing in the background and a quick refresh of this oh this wasn't the best idea did it run did the event get triggered let's do a little debugging so event log what's the difference between scheduled job and the script action scheduled jobs oh i missed that so we had business rules run on database triggers view actions run on manual triggers schedule jobs run on a timed basis daily at 2pm every four hours okay that's a scheduled job you don't know when an event is going to happen an event may happen when you impersonate a user that's not scheduled it's not database triggered definitely not manually triggered so we've got different ways to run different pieces of code so script action event triggered schedule job time based good question uh can you please tell me something about the queue and how to create custom queue and how to use it i'm gonna do that on a different one i don't know if we're gonna have time to get into that depth of it today i'm gonna change my mind on that ui action first let's find out did it trigger the event the answer is yes i clicked it twice there it is did it run processing duration it was processed yes everything looks good there how about our system log did it actually do anything open up a new tab and i was at 7 32 and this one was at 7 32 should have run it counted the records maybe my update wasn't commented out of my script action i thought i did no i did that student account program count it ran it just didn't update the records apparently let's go to the programs records oh it did okay so the thing about the event processing engine is you throw an event into the queue that doesn't say run it now it says run it when you get to it if you're doing say a ci import and it's triggering an import for all those ci's and somebody wants an email sent it may have to sit and wait that gets into the queues and again i'm not going to get into that too much but don't count on events running immediately could take a few seconds it could take a few minutes it's going to happen eventually when the event queue processor gets around to it but it's it's going to happen in the background so use these where you feel you need something to happen eventually it's going to happen good question what is the sequence of execution on event trigger notification first or script action hmm we'd have to do an experiment i don't know that's a good question would it matter does it matter if you're going to update i suppose if you had a script action that updated records somewhere uh and then triggered a notification you might want to know if that you if you're using the latest and greatest record that might be a use case for that good question all right back to script action use case two we've got this one that we can trigger manually next use case i've got is i want to keep track of who is using this impersonate button okay i've got people impersonating but i don't really have a log of that well there is a system generated let's go on personate able tutor real quick just to watch the event log and then end the impersonation there is a system generated event called impersonate and if i go to the event log there it is impersonation.start and impersonation.end now i know who's using your personally and look there is a user id this is not a society this is not a reference field it's a user id it's a string field that's what part one always is it's always a string and who did impersonate so i am going to leverage that let's create a quick table to log our impersonations back to studio create table i'll call this impersonation log and i don't need let's put it in the cls module just for fun create a couple of tables we want uh i might have to look at the string and reverse engineer what i put in the table the first time but it's going to be probably the user as a reference to cis user come on user that one let's take a look at my other script impersonation logger oh this one's global interesting okay whatever reason i didn't do this one in in a scope and there may be a very good reason for that i just don't remember what it is right now but just to be different let's get rid of that okay we won't be using studio for that today let's get rid of the system log and go back to the little sculpt just because i know a lot of you are doing development in global i will create a new table tables tables table system definition tables and create a table called impersonation log and it's called you impersonation log right impersonate the log get the name right personate log doesn't extend any table i don't necessarily need this but we'll put one in anyway and i've got a couple of fields in here i've got the user and the count okay who are my frequent impersonators and then i can go talk to them so user is going to be a reference to the users table the count is going to be integer and default value will be zero there we are keep in the back of your mind integers are stored as strings and you're going to have to convert them that is that hopefully we'll be able to create that module yes maybe i don't know let's look at our script okay this is going to be triggered on the impersonate.start event a system event already out there we're just going to take advantage of it because i don't know what else is going on with that event but frankly i don't care i just want my logic to run when somebody doesn't impersonate and that is go take the parameter that was given to you chuck tomasi i already know that find the count for that user the user already has a log entry updated ah okay good i'm not going chuck here chuck there check there i'm just finding if chuck has a record if so i update it by incrementing the counter value if not i create a new one pretty easy but i have to first get that user record as excuse me turn that string into a user or do i no it's not a reference it is a string because i am just saying go get it by that parameter better change my data model a little bit this will not work this will try and put a chuck tomasi into a sysid field personate log fortunately it's really easy to fix the data model i should have had better notes on what my table should have been save that goodbye user field put in a new one user is a string done this database stuff is killer i also want to make sure that my script has the correct field names it should be you underscore right let's make sure those field names are correct now look at count it is you underscore count if i look at user it is you underscore user so my script needs to reflect that so get you underscore user that's the table name set value you underscore count i also have it referenced here and here i'm going to mistake when you flip between scoped and global apps let's say we try it out let's go and create the script action that goes along with this so script actions under events or system policy events create one and called log impersonation impersonate make sure it's active and then go find impersonate.start in this list right at the very bottom of where i was typing condition script again i could run this under certain conditions maybe if the impersonating user is admin i don't care or maybe i do care you could put if if event dot par one equals equals admin or not equal admin so there is my script i take advantage of event parm1 to get the user record then i get the count and increment it submit throw some holy water on my instance to see that it runs impersonate able tutor again i could have captured parm2 if i wanted and end impersonation let's go look at you impersonate log.list and i have hey chuck has done one impersonation congratulations if chuck went off and impersonated another user howard johnson did some stuff as howard came back and impersonation i should see my impersonate log from my recent things still says one hmm two i logged i unimpersonated faster than the event processing engine could process that event but you get the idea okay i could take advantage of these things and make it very easy if your user ids are things like h013357 and you don't know who that is obviously you would want to do a little bit of lookup on the sys user table convert that to a ssid and make this a reference field or do both but the user id from the parameter you could say barm1 was this the lookup told me it was chuck tomasi employee number whatever and your reference field does the rest for you can i use event to count mobile users too if there's an event that's being triggered you can write a script action for it absolutely i haven't checked on mobile i don't know what events that throws how to minimize the large number of events being queued be careful be cognizant of what you're doing i know that imports by default if you're running business rules those business rules could be generating events that was one of the things early on i don't know if that's still the case because i haven't done an itsm implementation in a while but as you import a lot of cis it's throwing like a ci dot updated event and that will flood your queue and you need to sit there and wait so maybe you run your import without ci's that's going to be in the imports without business rules running that'll be part of the business the integration series wow brain's all over the place any other questions how do you run the event on impersonation did you give a brief how do you run the event i think we just did we set up a script action the event is already being generated it's a system-based event i didn't run it i didn't do a gs.event queue anywhere so now you know a little bit more about gs.event queue how to trigger your own events and how to react to events that are triggered by the system itself as well uh what else do we have sometimes the event table has so many events to process and which affects the instant performance how to manage the situation yeah again it's it's really being aware of what what is being done most times i've seen performance issues with the event processing engine it's because somebody is doing something very repetitive and not recognizing that they're triggering an event most of the things you do in a script don't don't worry don't put things into the event you would have to physically call gs.event queue you may be running something that's out of the box that's running gs.event queue but when you're the time you get into trouble is when you're doing something very repetitive i update this record i update that record i'm updating 10 000 records you could potentially be triggering events it never hurts as a as a diligent developer it never hurts to look at the system log periodically and find out what's happening am i getting warnings that i don't know about i filter out information am i getting errors that i don't know about am i getting whoa what was this when did that happen look i got a big ugly stack trace at 7 42 a couple of minutes ago was that me well you scroll over here to the source apologies it's a little a little large on the font size over to the source and about halfway down the stack trace we should see that it's from the evaluator someone had a problem was it me was it not could be report alias configuration is it doesn't sound like me never hurts to look and see do you have errors happening report alias configuration is disabled something's having an issue on this instance that needs looking into i'm getting some errors the other one is look at the event log periodically understand what's happening if you see hundreds and thousands of some event back trace it use the code search feature in studio to see if you can excuse me see if you can figure out where that event is being triggered from and understand why is it being called that you're going to have to do a little detective reasoning if things aren't being processed as quickly as you'd like and you can find out if they're being processed quickly from of course the event log it says when was it cued and when was it processed this one started at 747.01 it was processed eight seconds later glide dot heartbeat okay i think the system's just gotta hurt me he probably don't worry about that one that's not the source of your problem okay it's running what roughly once a second or so once a minute once a minute that's not going to clog up your backlog it's going to be the ones where you see multiples of them every second report.view somewhere there was a system report being run i don't know exactly what that was for i must have loaded a home page oh i loaded a home page when i impersonated the other user we saw that so you could see all the events that are happening get familiar with them get comfortable with them and you can also react to them with script actions so that's my deal on script actions they are a wonderful way to do some processing in the background based on a system event the events could be yours they could be system generated and it auto by running them in the background you automatically make them async i ran into a situation where i was trying to do a scripted outbound rest message and can't do it from an after business rule but i needed the after business rule to have both current and previous objects because if you take your business rule and switch it to async you no longer have previous you just have current so i needed current and previous but i needed that rest message to be triggered by the business rule and run async so i set up a business rule and a script action made the after business rule trigger an event which then started the script action which was fine running the outbound rest message because think about it if you tried to run an outbound rest message synchronously you could be waiting an awful long time and that would hold the user hostage their browser they go this system's slow i hate service now it's slow because you're not doing the process asynchronously you're making them wait until everything is done on that after we'll get business rules again sometime could you please help me with guided tour launch issue uh good question for the community not doing much on guided tours today but uh thank you very much for joining me hope you can join me on thursday the 3rd of september so we'll be doing this again in three days when i talk about glide session there's some interesting stuff in here that you don't want to miss and we may even talk about events again see there's kind of an order that this goes in so join me for glide session discussion thursday september 3rd 2 p.m utc and until then be safe be kind and share what you learn make the world a better place take care everybody [Music] you
https://www.youtube.com/watch?v=x_hEVZV5cdQ