logo

NJP

The Formula Builder - Live Coding Happy Hour! 2022-08-19

Import · Aug 15, 2022 · video

[Music] so [Music] hey i'll i'll be right back i've got to watch this thing yeah nice way to see like the slight delay between the air and the recording view great job lauren lauren is driving the controls today for the first time she can remove the trainee badge heck yeah even watch this even get zoomed in all nice and pretty all right don't go all earl on us yeah welcome to live coding happy hour this is the show that takes you through what i like to call an unpolished demo in fact it's the antithesis of a well-polished demo we have a mission we have some new tools to play with and we take you on that journey through the discussion etc etc so we're gonna scrape our knees we're gonna bump our heads we're gonna but we're all going to learn together that's what i love about this and the community the live people are right there with us to go along with the on the way before we begin let's do some quick intros starting with this young lady hi everybody my name is laura mcmanaman i am the new member of the developer advocacy team i've worked with servicenow stuff for about seven years and worked at servicenow specifically about five and i'm very excited to see all the cool stuff about formula builder today so off to you you chuck thanks i'll just you know hand that back yeah mess around with the screen my name is chuck tomasi senior developer advocate at servicenow been here since 2010 was a customer for a couple of years before that and way back in 2016 at knowledge16 someone was in one of my app dev courses right in the front row so yeah we have we have a bit of a history even before she got to this team a few weeks ago so very glad you're part of the team lauren it's been a lot of fun it's been a long journey and uh let's let's uh introduce our beverage of the day i'm excited you go first i'm all pumped no we're going the same order as the same order okay well this is so in in honor of tokyo i've been trying to do a new sake every live coding happy hour so today we have a han jozo sake which means that it is i believe that means that there is alcohol added to it like it's not just pure rice and this is actually it's called the karakuchi which means dry so it's a more traditional dry sake so we'll see how it goes i think i've seen that label more than once that's that should be an easy one to find right yeah we have really easy to ask your local kroger employee what this says you you don't ask you just look for that one yeah it's that the only downside to sake it's like oh i have to take a picture of this for sure i've got two to choose from from the same vendor i'm still on my hawaiian vacation from july so i've still got some kona brewing left to go i'm going to start with the kona light blonde ale since neither of us are light blondes here no not anymore it used to be i gave up on that long ago my favorite sound of the whole show ah yeah that's the only again another downside cheers to all y'all out there happy friday happy friday let's end this on a high note the um where are we oh man we got comments galore coming in so lauren's job is to keep an eye on the comments and then run any titles what we got and in case you missed it which i seem to be writing a lot of on on social media these days uh lauren point up with your left hand to that nice circular logo right above your ear if i can get it shot there we go i love watching people try to do that like where is it going the storm front is moving in from the in from the east yeah this is part of our tokyo content as also indicated by lauren's beverage of choice we are going through our tokyo early availability early access period at this point started on august 4th with our tech now kickoff and you can find all of the information about tokyo at devlink.sn here comes here comes yes [Laughter] what's bad is when we both start poking at it like it shows up and goes away and pops up pops out yeah so i'm i'm keeping hands off the controls today this is all on you i've got you so go over to that link you can find our calendar of events you can find it organized by topic if you missed something we'll have links in there if you're looking forward to something you can mark your calendar on it so i know a lot of people were looking forward to formula builder so that's today's topic according to the schedule and uh we also have a discussion with matthew ripley sorry i just recorded it yesterday edited it and gave him the draft copy today we have a podcast called breakpoint i don't know if we have a breakpoint flag in there anywhere lauren but devlin.sn slash breakpoint is where you can find that and that will be coming out on the 20 i've got to come my wednesdays what are the 24 26 later this month so we should have that one in the wednesday shortly so we'll have it's every other wednesday one's coming out why man no like next week is the 24th already that's wednesday i know we all know i was i was ahead for a while i keep looking at the due dates for a lot of my tokyo content it's like oh it's september or something i'm like that's not too far away especially when you're counting that holiday weekend it's gonna be like hop skip and we're there like ah yup a whole family's coming in between two which definitely is a time commitment as well okay so let's take a look at formula builder this is a new technology and the reason we came out with this is to give new people low coders a way to ease into service now for calculated fields now traditionally you've probably seen calculated fields with like the cis user table has a name field and although it seems like it should be simple of first name plus space plus last name there's a whole formula in there of javascript and you know a lot of people just don't gravitate to javascript really easily they say hey i've got this amount that needs to be price times quantity well you got to use javascript and they go ah running for the hills okay so we we fail as soon as we introduce a simple formula we've got a way to do that now that's a little more comfortable a little more friendly this is not exactly excel syntax this is our own syntax but it resembles excel a lot and if you've ever written an excel formula you can figure this out so i'm going to show you a couple things and realize like many of the things we release this is an mvp so not everything's going to be there lauren and i were just discussing and i said hey there's one thing we're gonna have a challenge and she challenged me back and said i think you can do it so we've got we got a whole bunch of stuff i made a little mock application and i say we just jump right into it what do you think i like to i like to hear that which is your preference is it this view or is the one that is full screen let's let's give the viewer the most they can see i'm going to get rid of that so we're seeing what we actually are supposed to be seeing fantastic this is uh this is i i had no imagination i just made a like parts ordering system yesterday uh if if you're ever looking to make some quick dummy demo data there's a site called macaroo m-o-c-k-a-r-o-o that you can crank out a csv or json really quickly it and and i did this with this in fact these part numbers are actually like what do they call idc 10 medical codes really could mean i'm having a heart attack this one could mean my surfboard is on fire i don't know somebody's i got a buddy who will be able to tell you a handful of these yeah there was like what was one of the funniest ones he told me was water skis on fire like you you got in an accident with water skis on fire they just make up codes now look at that she's making new labels all the time so fun like to go make something up if you need some first names last names anyway but i don't i don't pay anything for them they don't pay anything for this so just one of those things that comes up every once in a while he's like i need some generic demo data so i made this quick application i called carbon and gave it 100 records and we've got some things we need to do to this and i purposely engineered it to have lots of formula opportunities in here so if you look at any one of these records we've got a first name and a last name but on the list we only have name okay so i say step one is let's build a formula to calculate this name for us absolutely in fact chuck and i were looking at the all the calculated fields that exist on the service now and incidentally like a lot of them currently revolve around like asset management and things like that so i think kind of basically trying to see how many of these legacy use cases for calculated values that we can use with formula builder will be ultimately pretty fun it's really hard that was my challenge yesterday normally earl was going to be presenting this topic but earl had a personal uh emergency to deal with so he can't be here so at the 11th hour lauren and i jumped in and said earl you take care of the the family you take care of you we got this and since it's live coding happy hour we can screw up as much as we can and yeah i i just did this monday for creator toolbox and it worked out all right and that had higher stakes so let's um i'm going to first go into the dictionary the old-fashioned way because because normally if you you know a lot of times you'd go all right right click on the field and configure dictionary or or oops yeah there's there's my first oops take a drink let's go to app engine studio and this is a scoped app that started life in app engine studio we wait like all good demos all good live demos and i have my carbon app and it's really not much of an app it simply has a table uh oh i guess i made an experience too let's go to edit so we see the table editor and there is a formula editor in the table editor however you like that if we go to name don't want to edit it and i bring up the properties over here oh i can edit it here okay i was i was confusing myself because i thought from the form editor uh we don't have the name field on here so you can't simply click it so normally if you click it you get formula at the bottom but this properties panel is the same as this properties panel oh that's first name i got to get the name the name name go to name there's name all right so we've got our formula and i'll show you the reason i like this better when it's available which should always be now is let me let me show you the side by side if i go to configure dictionary and i can do it on the whole table and bring up the traditional dictionary entry record this is the back end representation of this and in order to see the calculated field i've got to get to advanced view for the for this to be an option does the field type have to be anything specific um it will the the formulas we use are specific to the field type true you know that's a great question because editing from here brings up this formula editor editing from here is a straight old script box correct so that was a good question from phil goes deep was is is there a limit to where the calculations can occur based off the i mean i assume that like the image field type would probably not have a probably not have a calculated version but you know who knows i'm not quite sure it's a good question so we want to let's let's look at the documentation real quick i do happen to have it here and one thing i discovered if you simply look for formula builder first of all i can't spell formula right away without first spelling form i don't know why it's a muscle memory problem you get a lot of performance analytics stuff formula indicators creating a formula indicator formula builder uh still not the best what i found is if you look for table builder in the release notes or tokyo lauren i think you showed me this one yesterday there is a formula builder link right there okay that's step one you could do that or if you remember this next part really well the title of the page formula for column formula for column we'll bring up formulas column right there that's the page you want see that so this will bring up the same page either way i often go through the table builder page myself because i can never find formula builder anyway we have several several formula functions i guess we're calling them yeah that you can use we can do an average of some numbers now this doesn't do a glide aggregate for you this takes whatever's on the current record so all of this is current.something if you want to think of it that way there's no scripting that's the point of this is to reduce that technical debt reduce the scripting we've got average we've got divide we've got max min multiply power so you can do exponential raising something to another power subtract sum concatenate that's what we want for the first name last name thing is blank does not do what you think it does it doesn't it's so sad it just says it should be has blank because it will return a true or false if you have a blank in there so example underscore string has no blank but the value of full name like lauren space mcmanaman will return that so i i don't know who named these but maybe i'm gonna can we blame excel at this point i think we might have to at this point we're like oh it's all length returns a string values length which is nice to know and we might be using that today if we get time lowercase replace title case uppercase i don't know why these aren't alphabetic they really should be now has nothing to do with service now it simply tells you the current date and time in iso format and we have we have logical operators in case you want to do something inside an if we have an and if and or okay so we've got we get a lot of the basics down yeah especially for the first release of this type of product that's always really good to see yep i would have expected we had about five or six like like just eight like add plus multiply divide so let's start with concatenate and when we start typing it starts doing an autocomplete for us and then it gives us the syntax down here again formula editor in table builder wicked cool better than typo mistakes in the dictionary entry field so we are going to do first name plus no not plus it's all commas see i was slipping into javascript mode there it was a nice uh it was a nice use case to see how it checks your syntax yeah isn't that cool so it goes uh if you have a comma it says did not expect the parenthesis token when parsing expression and it also tells you as you start typing these things you want to do a lowercase or do you want to do a little it's like no that's my complete formula now if my data were not all proper case i could do something like idle case of that which probably wouldn't be a bad idea and then another one here though ruinous to us with irish last names with multiple multiple multiple uppercase letters in the middle so apparently the function names do not need to match or should they you can click this title case and it says here's the the format of it too so i'm kind of digging this thing i don't know if this will work with lowercase title case let's find out do you need the value in the middle did i miss it the two uh uh parenthesis not parentheses uh yes i'm having a brain fart yeah yeah because that's going to be part of the concatenate i want to concatenate of course yeah the middle that's right yeah something tells me i have to make these uppercase because they're not recognized as a keyword but notice that i can't edit straight from here you can hear me banging on the key nothing is happening let's go ahead and save that and if you notice the dictionary entry was updated now here's the key in the dictionary not only the calculated turn on but formula i can always flip back to script and add script there now don't do both it will do one or the other but it won't do the other it won't do both uh we need some demo data to show us that the title case is actually working so let's go to our open orders take 1077 and if this data had come in this way run scene we update that okay it appears to be working now i have a quick question for you what happened what happens if you change your mind and you no longer want it to be a calculated field like if you remove the calculation what happens the values are already there so there are actually this is this is something i learned a long time ago there are no values here in the record in fact if i if i go to let's say 1023 and i say show xml what do you see in oh it did update something oh okay that's not the way i learned it and i thought my testing yesterday when i was building this out showed that it was still empty i know that when you update a record like i just did francine's name with lower case and said save then it saves it to the database otherwise it's only displaying it when it needs to display it so if you went to query for some of these you might have issues i'll i i've got something that'll verify this for you but at this point let's go and turn that off i don't know how you can turn it off from here but i know how i can turn it off from the dictionary yeah because like would it just save them the most recent value in that spot that i guess yes yes it will interesting it's cool so if i say let's take the name field i'm going to open up my records in another entry so calculate it if i uncalculate that and say update the dictionary and then all open you can see this one yeah that's what i was getting at if i went in here and said show xml the only one that it becomes persistent is the one that was updated when that calculation was done so just like the calculated field logic when you script this thing says i don't have a value in the name field i need to calculate that and show it to you when you save it it says oh while we're saving i see you have this calculated field value so i will save a calculated version of that to the database important distinction because when you say let's let's do our next one let's take the amount okay okay so i have some details of this order and for simplicity's sake let's start out with quantity ordered times the cost is going to equal the amount what function do you think we'll need lauren repeat the question sorry i was i was making sure i was monitoring the chat how do i calculate the amount uh quantity order times cost works for me we're going to start simple we'll see if we can get that discount in here in a bit so i i don't trust myself enough yet to go straight to configure dictionaries uh let's go to amount and over on the side panel it it looks funny because i've got my font extra large normally people would see it something like that but i'm doing this for readability so add a multiply tab oh i love this this is getting better all the time yeah quantity ordered and you can just click times um what was the number the cost price uh well it's oh it's saving an amount but cost and i believe if you start typing field labels it will use field labels in case your labels and labels and names are not the same so we try that we save that and refresh this come on i missed refresh that and we get an amount hooray oh yeah okay now here's here's where i prove myself that the value you see on the list is not what the value is in the database because if you were to do something like configure list calculations and put a total at the bottom it has no sum there's there's nothing being calculated because there's nothing in the database yeah that could get a little wonky so if i went back to like 1077 and said all right let's update it with something get francine's name one more time now it has stored that and that's only that one interesting so one of the questions that has been popping up in the chat has been something along the lines of you know uh there's been conflicting advice about calculated fields in the past especially when you have things like business rules that exist so what would be the best scenario to use one or the other hmm here i'll put it back together because business rules have to take time to stop and run i don't i don't really have a best practice of one over the other they are options they both have their advantages and disadvantages uh a business rule is only going to run when you have some sort of database transaction and insert an update that kind of thing this will obviously do this for a list now my question is let's let's turn name back on okay let's turn name back on because i want to see if you can do a query against that good point advanced view uh calculated on my formula's still there it's kind of nice usually it wipes those out it's nice it stays okay no stay so let's go back to this list we get all these and say find something that contains park oh okay so you know what i would do here's what i would do since we know that it updates these on insert and delete yes if you employ a calculated value on existing data i would go through and do a glide record force update i don't know if this update is allowed on i don't think it's allowed no on scope fields it's called apps so that's that's something to keep in mind so what that would do is if you do a force update it says i don't care if you changed anything or not you're going to do an update on this record and all those calculated values will be stored as persistent values so that you can do these kind of queries best practice create your calculated values before you execute data or create those records or you're going to have these legacy gaps if you have those legacy gaps you're going to need to find some way to force an update to that record so that it's recalculated and stored absolutely so what you're saying is this is great for any new app ideas that you all have out there just make sure before that app is storing data that you're you're building those in beforehand yeah and maybe i you know we should talk to the product managers and say hey if i change a formula you might want to do a check box or something that says do you want to update all existing records oh good point that might be a good enhancement request yeah okay let's go back to our orders we got our amount yes we got our amount uh what do you say we do another one i have a priority field and the priority field currently has two values unfortunately it's also read-only most of most calculated fields i suggest making read only so people don't jack with the value that's stored by the calculation i am going to base this priority off of the amount so if this order was more than 30 000 whatever this is yen yuan rupees i don't dollars it does it has no amount it could be you know 38 000 cards from debt crimes against humanity uh i am going to make another formula for the priority so you can use a calculated field based off of another calculated field so there's priority and we go this time we're going to use an if so we do a conditional and it is logical test value of true value of false almost looks like a ternary operator to me so let's say amount is greater than 30 000 then the value is going to be high otherwise it's going to be normal submit back to the list and we see nothing did i i didn't save that that does work wonders there's one take a drink it's like my mom she always says whenever she forgets her keys it's like clockwork she goes well they do make the car go faster it's like your catchphrase all right so we have our amount we have our list and we have some that are high i put in the field style just for you know funsies so you can quickly see the high interesting point something that i just put in the slack til this morning the select channel till things i learned uh i pinged ashley about this and i said what happened to the coloring around the words that we saw in next experience and the answer i got is it was taken out because of accessibility reasons back to the old colored dot i don't prefer the color dot because it shifts the characters around which is really annoying if you have numbers or something uh you can always do this go down here and say modern cell coloring off i was around when i asked tyler jones to put that in and it does this like ui 11 treatment to it it's still available i know my brother who loves his excel spreadsheets loves that style as well my favorite was the styling around the letters my it's like where did it go can i have an option for that too another toggle for them to add i'm not i'm not you know if visually impaired so can i have one that i like anyway um so we got priority we got him out we got first name last name uh there's another one in here that you seemed intrigued about i have a couple of dates in my demo data yes i have a date ordered and a date shipped and i would like to calculate the fulfillment duration now let's find one that has two dates in it so we can start out simple so we need fulfillment duration for some reason my achilles heel is always calculating oh it's between times on service now time zones and don't get me started it's my all-time problem i've never been good at it i don't think i ever will be my my best advice for anyone doing that in javascript is if you're going to use get display value or set display value use it always don't switch to get value somewhere or you're going to introduce a time zone offset somewhere if you stick with get value and set value stick with get value and set value and you are basically ignoring the time zones but don't mix and match them or you're just going to find yourself in in a bad place okay this one has a function time diff time diff evaluates the time duration between two dates and returns a duration now did chuck do his job right this is a glide duration this is obviously a date it has the calendar widget on there don't ask me if i you want to use a date time i don't know maybe we can play with that next week so let's do time games there's also the due date field type 2. time gif and we want to put in eight shipped is it which way does the calculation go high value low value uh o2 407. so it looks like it's going high value low value future past yeah okay important to note you know pay attention to those things that there was you get a whole bunch of negative variations yeah values yeah so what did i say date shipped minus date ordered see what happens save don't take a drink and we do reload form 11. okay that's my dream come true right there if if this is apparently it doesn't do anything because you haven't shipped but i would like to use a default value of right now how many days has it been well obviously this is the 19th so we should see one day in there right that would stand a reason right you want to see of course or if something is you know two years and it hasn't shipped yet why not um so let's see if we can beef this up a little bit now one thing you won't find in here is an equivalent to a javascript dot nil is nil is null that kind of thing so that leads us to a question we we thought we could use is blank but that simply says you have blanks in your string which i guess we could use because this date doesn't oh wait no dates the dates wouldn't have a blank in them anyway so lauren you had a creative idea that we have to try this is live cody happy hour i don't know if it's a good idea it's an idea hey any idea is a good idea it was to use the length property now normally this would be used on a string but since a date is stored as a string i say we give it a try it's worth a shot right now because right now it doesn't seem that there's an ability to determine if something is empty through this formula builder we need we need to edit cut by my own words again if can we put an if in here we can put it if there and say um date shift length of date shipped is greater than zero than we would you had to move to greater than zero outside of the length i'm getting there i'm getting there okay then that way otherwise we will use now i think i have too many parentheses in there because it automatically put one in for me yeah roll one two three four you need a parenthesis that says no this you just want the length of date shipped though you have the ground oh you're right you're right i need that but i also think i need one out here again no i think you have right how can date ordered when parsing let's let's write this piece by piece okey-dokey okay so if length of date shipped is greater than blah blah blah we should have no that doesn't go there that goes out here it does we need we need length of date shipped oh you're right you're right because this is calculating a length can we can we do another line yes i want to do a var so bad that's just doing calculated values and then we need our if on it well this thing really it only colors color codes you if you hit tab but it works anyway our if is going to be so our yeah this is where a var would be nice right yeah that's where our length comes up of date shift greater than zero do x do y yeah right and then we're going to take the time diff of whatever the if gave back to us or if would go there reasonable i think i i think i thought the time diff was uh it had three values inside of it you're right you're right or two values not three um it's going to take the first one because this is going to return either oh well i know what we're doing greater than zero we take date ship if it's not greater than zero we take now we do time diff yeah and then time diff is going to take the if inside it no no time def is inside the if statement so if the length is zero we need else right we need either this or this compared against date ordered the the time gif originally looked like this let's put this back date shipped date ordered what we're replacing is the date shipped with this conditional do you want the date shipped or do you want now well that depends if the length is greater than this although i don't need an else no the else is use the now okay gotcha sorry if shipped is is zero then we'll use now okay so i think if we write the original wow this hovering over is getting on my nerves okay so we need to just copy and paste things into their respective places this gets replaced with the if all right this is where the this is where the agent scripters like me go it was easier javascript trust yeah and then we take length of date shipped and replace it with that look at that the error message went away okay i have a new way of debugging these we are working on a tester checker i heard that from matthew as well so there's more stuff coming this is not the end of the story obviously and more functions like uh is empty or is null or something i hope we don't even know if this will work we spend a whole lot of time on something that may not work that's just to test whether or not length can be used as a is empty or not right well let's find out reload form i'm so happy i just jumped out you win laura for the win let's see uh let's move it back a couple of days let's go back here and save awesome and then let's say no it was really shipped yesterday and save oh that is so cool oh my gosh this makes it worth it that's so okay so length is a a suitable replacement for blank you did no getting a length of zero even for objects is at least in this circumstance at least for a date object works we got fulfillment duration hey should we go for broke and try and figure out if we can work in this discount we got the time we got some time i'm taking a drink for that celebration oh yeah earned it there we go let's move on okay so let's say we have this well that's a hefty discount of 76 now this is a whole number it's not like 0.76 that would be too easy right so i need to think about how this works with applying a discount to an existing number without repeating a whole bunch of formulaic stuff so let me just bring up some dumb text editor make this font large enough because i want to i want to whiteboard this in my mind yeah so let's go 48. i want the right now we have cost times quantity ordered equally never mind about the quantity shipped if something's back ordered they still pay for it i'll just get it later we want to take that so a var would be nice again we we end up with our amount so what is it we're literally six percent off or is that yeah that's 76 off it's great it's a really good discount then we're going to say uh i think we're going to have to repeat some stuff in here it would happen i'm assuming parentheses will give us order of operation i hope so i mean there are there are operators like logic operators so logic's not going to do us any good in a mathematical calculation i mean i guess that would imply that syntax does uh it would be minus uh discount times cost 76 we would have to well discount divided by a hundred because it's not seven it's not point zero right then it would then if you multiply it's gonna be multiply i'm really struggling with my basic computer science 101 here and my freshman high school math someone's got it cost minus cost divided by 100 times discount sam is sam is suggesting something in the chat this is why i love live coding it's helpful cost minus so it'd be 76 minus oh wait cos oh you want to apply it directly to the cost and then multiply times the quantity you ordered that would make sense if we if we applied it or don't we have to apply to both no because multiplication is transitive so it should work okay let me think about that it's got cost it would be discount divided by 100 though times cost what about times cost all right let's try that cost times discount and then we still have to multiply it that's going to we need to subtract it though from something don't we we do need to subtract well we need to subtract the other part the 34 percent the 24 percent correct that's why we needed that minus part of it i mean if you're just using if i was using amount as a substitute the correct equation would be amount minus and then in parentheses amount times 76 divided by 100 correct this doesn't seem like the right thing i'm doing let me let me do some simple numbers here quantity is 100 and the cost is n we would have a thousand right for without a discount if our discount is 10 we would have 90. does that work in this formula 10 minus sorry it's it's not cost's amount though no yeah if the amount at this point if you just did cost times quantity is going to be 1000. if you just applied those first two gotcha if you then added this in of a discount of ten percent your amount is going to be nine hundred right because if you apply ten percent discount to a thousand you're going to get 900. yeah how do you make that happen it's going to be uh i'm just going to brute force it for now i think me too has it correct in in the chat who had it right i think right that's what i was afraid of lots of duplicates yeah so let me write that down yeah cost times quantity minus discount divided by 100 times cost times quantity yeah it's hard because cost and amount are similar amount is you know the the okay cost times quantity minus this is this is pathetic right now it's friday everyone's got friday and we've been drinking don't do don't do maths and drink sometimes i'll bet somebody had to google this cos times 20 yeah hey does that work discount divided by 100 but yeah so cost times quantity is a thousand minus discount divided by 100 i think it was supposed to be yes it was well we're getting a lot of answers the discount divided by 100 is one no 0.1 times that it's going to be 100 so yeah yes this is i think we have it okay now we have to translate this into formula editor whoa we're not don't woo yet okay we need i need to be able to see that i'm gonna put that on the other monitor for a second and see if we can engineer this uh where how many monitors are needed to do basic math i've got five i'm ready to go you have five monitors the the fifth one is uh there's there's four that are hardwired well one built in three that are hdmi and one i can do an airplay too dang that's a good setup that's a studio you gotta do it you gotta do an office tour sometime i you know i am yeah i do yes i i was just thinking about that again today it's like i need like a sizzle reel of what's in my studio okay we don't yes where do we want to start with this we need multiple multipliers like last time quantity we have that we have that minus uh our discount divided by 100 times quantity ordered can we use the times and divided by or do we have to use the oh if you multiply you got me okay so let's well let's take this apart we just did this part we'll do divide here start with the inner ones and go out starting from the inner ones we need to go out so let's do multiply here and that's going to be oh thanks quantity ordered this editor is confusing quantity ordered comma cost okay that means we get to get rid of this part yeah this is way easier [Music] then we take this and do our divide right discount divided by 100 so let's do divide discount 100 then we multiply those two together with i have to do it this way again multiply part one otherwise it starts injecting parentheses and gets me all confused yeah okay that becomes what goes in there oh i still have a syntax error somewhere did not expect token right parenthesis when parsing expression which one this one too many met left parentheses oh there you go it didn't get rid of the error though it means i probably have an unbalanced one here there okay good so multiply this minus the multiply multiply yes multiply multiply disc divide i think we got it i think we do too oh what is this minus minus it has to say subtract oh kill me just kill me now i'm glad it should just say that hey idiot what are you doing oh that's going to be a great sound bite chuck kill me now yup there we go hey it came up in the editor it it it liked it all right lesson learned don't give discounts yeah reload form uh that looks about right we had thirty six is that three eight k in there before let's do something that looks correct quantity ordered let's see yeah discount 10. do the dance oh yeah heck yeah whoa this is worth it you know we should have done this back ordered one real easy that's just a subtraction we should have done another easy one let's say we ordered 500 if we ordered 500 and the number received was 464 i'm going to do it just so we can end on a high note here and get them get all our requirements done yeah um what was it it was back ordered back ordered is going to be and if quick this will be easy compared to the last one subtraction 100 we should have done this easy so we remembered subtract quantity received no quantity ordered minus quantity received you ordered you know once you start tinkering with it it doesn't let you go forward again quantity ordered it's quantity received i hope he says with all full confidence reload hey that looks right let's go to the list okay what's our what's our amount down here say 4 500 because that only that first one has a static value stored yes a persistent value i should say you know what i want to try and fix that where's my scripts background come on let's just find out if scripts background var carbon gr equals new glide record let me make that a little bigger for you record x 6238 carbon order carbon gr dot query carbon gr dot can we do these all at once you have to do i'm gonna do it one at a time that's what i've done in the past carbon gr dot next and [Music] carbon gr dot force update i think this is the part is going to get us in trouble i also couple this often with carbon gr dot auto cis field it's a plural i think it is true no false don't [Laughter] is it auto cis fields are updated i've not used this function before date cis fields all right gotta look i break down developer.servicenow.com this will tell us for sure too whether it's in scope or not uh auto we're just going to glide record i can't remember the name how are you supposed to look it's like spelling a dictionary look in the dictionary you see how to spell a word that you can't spell yeah glide right oh this is a training guide i didn't want a training guide i don't want that well you're looking for that i'll use this opportunity i just did like a search i want reference server scoped i can do this don't drink and document kids write record and i want auto put in there force force is strong with this one look glide record there's no force update we have a problem rats because it is there in global is it auto that's not even in there force update is available in scoped it is so what are the uh what does force update do it's on the function i haven't used before it says i don't care if you've made any changes to this or not you're going to do an update gotcha makes sense that will save our persistent fields ah smart calling mark carleen says it's set force update i think you're right i think you're right but it's not available in scoped she says that's [Music] but for something hey you're gonna find out you've got a good day i'm heading there i'm getting there okay run script and it says no you can't do this method not allowed exception that's what i was expecting um what's the other one i thought it was give me my docs back can we run it in global or no because it's a scope now you you would have to change the table to be modifiable by all other scopes which you could do temporarily i guess you update set a board action no set workflow you would probably want to also use set workflow false on this if you had any workflows or business rules or flows or anything carbon er.set workflow false the other one go back to here we have five minutes i want to see this done um we're gonna go to server global and look for glide record because it has a few things that i don't it is auto sysfields is the other one that says don't muck with my date updated don't muck with my mod count don't muck with anything so do that don't do that i'm gonna take this approach can't do that from here make this so if this works in theory you could just create like a button that would you know you can create that would yeah you could but you know once the records are created yeah any time it's the first time existing data that you're going to run into problems so let's do table and go to application access and say this table is available from all application scopes well theoretically we don't need to change anything because that's the way it came to me out of the box copy that just in case changing the scope loses sanity run 100 records updated like to see that all records we'll know if our calculated amount is right woohoo okay so watch your table access it looks like aes i just learned something else here aes leaves this as all application scopes which kind of surprises me i don't remember changing it fascinating yeah i wouldn't think that was a good default that's interesting yep lauren i think we got it all done and then some well i think that is the the best way to kind of end off this live stream congratulations yeah all of our all of our challenge things done too that's awesome oh it's karaoke time indeed well thank you for helping out and watching the chat do we have any uh force update is available for scoped glide query not glide record oh good to know smart carlene very nice one thing that i got away with that uh one thing that we always want to plug is the build with aes challenge which is now entering into its latter half of it being active uh as of right now if you've not heard about this as of uh at the moment there's a post that is pinned at the top of the servicenow community where if you showcase a short video or blog post about what you really love about app engine studio and like show an app that you've built uh we'll send you a shirt i think i've already seen people receiving their shirts that's awesome that's nice to see saw someone social media and i had an internal guy say where can i get more of these shirts yeah i built some more apps dude uh and that ends september 4th at 11 p.m pacific standard time so you got plenty of time to showcase all the cool stuff y'all already built anyway september 4th isn't that like sunday night saturday night i believe so okay interesting time yeah if you get to monday after labor day in the u.s you missed it so good thank you for reminding me of that that's a good thing to plug uh yeah i think phil's is the one that i saw with the t-shirt draped over the chair yeah i'm glad you got it made it all the way to the uk so he was teasing us about the way we say math i'm trying to think what else do we have coming up i talked about break point episodes we have i i have to look at the content calendar more blog entries more creator toolbox more uh more more more tokyo stuff coming up in the next few weeks i did produce another did you know it's ready to go uh we're trying to figure out when to release it it may be as soon as monday we have two days in august earl pointed out we have two days in august where we didn't have a piece of content i said well use this if you want it's either going to be two monday the 22nd or the following week what was it the 20 no the 31st or something there were like two days in august where we didn't have anything so sometime in the next week or so you're going to see another short three minute and change did you know fascinating stuff that i jotted down notes this this comes from the wayback machine at least one of them there's there's it's a two for one two two did you knows in one one thing because it kind of went together so thank you once again anything else not my behalf cheers to everyone how was your beer it was ended up being a good picture let's say goodbye yet we have to rate our we have to rate our drinks go rate your rate your sake i really like this i don't even usually like really dry sake but this one had like a very strong hint of like melon uh which for a dry socket i think actually was ultimately better because usually they get too sweet so i'll give it a 10 i'll give it like an eight or nine i really liked it i'm dividing by two because our rating is zero through five okay fair i had to do that with our old tech now survey results too it's like they i hate it when you're like importing data and somebody changes the scale on you like no no no you can't change the scale they did that too it was like go through all the legacy data divide everything by two so that yeah you know you can compare old data with new data how did we do on this anyway i got sidetracked my beer the kona light blonde ale is gone well oh now it's gone i was like you were busy to drink that whole beer good for you good multitasker you stopped to make a comment i stopped to take a drink that's how that went fair uh i give this oh and we have a quarter point success factor too so when we're successful like we were today you're free to add a quarter point to your drink because they taste better when you win that's that's very true i'm giving this a four and a half i like this very nice well we hope everyone out there also has enjoyed their drinks if you had fun today uh be sure i think there's a banner for this as well be sure to subscribe like and subscribe any engagement helps if you have any questions about this in the future post them here and we'll do our best to make sure that we can answer them as well phil says what time is karaoke actually that's a work in progress right now we are working on a virtual karaoke party actually uh as a kind of a community builder the karaoke app i built does have a remote capability in it so that you avoid latency lag over zoom so we are we are working on a date it'll probably be in september sometime and we'll have to do stuff that is clock friendly to various regions so look for that we'll go around the horn if you just want to show up and watch people on this zoom you don't even have to sing but it's just going to be fun it'll be fun so we we are working on that i i put that feature in home about two years ago and we've only used it like once well in the past there was so many more in-person stuff so now that it's like oh it's finally got a big audience to use digitally it's great all right thank you very much for helping out lauren it was a treat presenting with you likewise always thanks for for for challenging pushing that envelope and giving new ideas this is the part where we wave say goodbye and the music plays right yes i got my finger on the trigger hit it have a good weekend y'all bye [Music] so [Music]

View original source

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