logo

NJP

Cooking Management Integration - Live Coding Happy Hour for 2020-11-06

Import · Nov 07, 2020 · video

[Music] hello and welcome to live coding happy hour on this fantastic november 6 2020 i'm your host andrew barnes here with my co-host brad tilton and we are here today to do some live coding on this great friday um brad why don't you kick us right into intros sure hey everybody my name is brad tilton and i am a developer advocate with the developer program here at servicenow i have been developing on service now in some form or fashion uh for about 12 years and um yeah i've been an employee for the last four excited to be here today uh we have a fun uh fun show planned i hope uh so andrew thanks brad and i'm in i'm andrew barnes i'm a developer advocate here at servicenow i've been doing this uh job for about two years here at servicenow and have been in the ecosystem for a little over six years as a customer uh developer and implementer as a partner and here at servicenow direct and yeah i'm super excited to be here with y'all today and and do some live coding today has been a getting stuff done day uh so it's been a no meeting friday so i've actually got stuff done so i'm psyched to to do some more stuff and get more things done um what are you drinking today brad yeah so i'm excited about the beer that i found today uh it is a from lakewood brewing it's a lion's share anniversary ale it's a russian imperial stout aged in rum barrels so you make me jealous every time you say imperial and aged and rum barrels uh jealous every time you do that today i am let's see what we have in here i think we went to piratey from the bottle yes we went parat [Laughter] so this is a belgian ale um that is uh you know it's imported from belgium uh so i'm going to enjoy this today let's crack it open so uh what we do on the show if you haven't been here before uh welcome um we do completely unscripted uh servicenow development here so just as you would as any developer at any customer or partner building on our platform you get a story you pick it up and you work it and that's basically what we're doing here we tend to show off new features on the platform or bring up things that have uh been uh noticed by us in the community like a a recurring question that's coming up or uh just a particular problem that we have to solve uh and whatever use case uh that that comes across that uh fits that will do that um so everything that we do on here is some actual uh thing that that we leverage so none of these are completely made up scenarios we stretch a little like our cooking app isn't essential we we like it and it's fun but some of our other stuff is we actually run the business of our group on some of the work we do um so there's a varying degrees of how rigorous we have to be with some of these um today uh brad we're we're gonna be working on your cooking app some more and i believe you've teased to me that we're gonna uh be linking that with uh uh some apple uh hotkeys set up to call it api yeah so so i um i was look i i was looking at something the other day and saw that the apple shortcuts which is you know basically a way to run little workflows on apple i think it's just ios and ipad os and you can call them with voice with siri but there's a way you can consume rest apis with it and i thought that's kind of interesting and so i i was looking at how we can incorporate that into the cooking app because a lot of the time when i am doing something with my smoker uh i have my hands busy and i do a lot of setting timers with my voice and things like that and turning lights on and off out out on my outdoor kitchen and that sort of thing so i thought you know what if i could also interact with the cooking app uh via voice uh so that's the plan uh and well that sounds like a fun used case yeah so useful yeah for you why you are you doing your cooking outside it will be useful um yeah upside down andrew i don't know if we'll get quite to you know smoke all of the meat for me but maybe we'll get partially there so yeah the goal for maybe some robotic process automation can handle that for us yeah some swivel chair automation yeah so the goal for today is uh just to be able to create a cook record from telling uh siri to create a cook record all right i didn't trigger anything that was good yeah that that sounds super fun as a reminder last month we did creator con i'm sporting my creator con shirt from uh uh what's this 18s the mission to mars here mm-hmm yeah about 18. it's 18. it was uh so got my got my little mission to mars shirt here uh hilariously i didn't participate in that but uh it it did i i got to go through it afterwards and it did look like a lot of fun and then i built the equivalent of that for last year's the brewery operations one along with my uh friend dave slusher so we built that one together so that that was a ton of fun um last week creatorcon happened uh you can go check it out uh and get all the content including a live code happy hour that we did special for that event and there's some good content in there especially there's a couple of new parish trainings workshops and informational sessions about what's new in paris that should be useful for you and with that uh let's let's get to the live coding part let's do the screen share and and start doing the do all right and on the uh yeah on the creator con we'll have a recap blog up next week where you can log in uh not log in where you can look at uh you know what uh what we did there all right let's share my screen this one and we should be screen sharing how uh we look like we're screen sharing to me where are we looking uh what zoom are you at probably not even zoomed in all right that's looking pretty good sir all right so why focus on my favorites all right so let's take a look at our cooking management application uh so my cooking management application i've got some different things happening but let's look at my cook record so this cook record is as kind of the base of our application so just as a quick recap both andrew and i do a good bit of meat smoking and so a lot of times those cooks are really long so you know you may do a brisket or a big pork butt that takes like 18 hours and so uh there are a lot of like log books and things where you know you can go in and kind of write down you know what you did in the cook and you know when you added logs and when you spritzed it or wrapped the meat things like that but being who i am i i thought you know i would rather capture all of that information digitally and be able to uh you know run some reports and then look at the data and so that's what this uh what this app aims to to do so if i just save this cook record i've got a lot of attributes like where you know i can tell what recipe i'm using what kind of food am i cooking you know am i using a smoker or a grill or am i inside uh cooking and then we also have a thermometer integration with my fireboard wi-fi thermometer where we can automatically grab temperature readings from the cook and then down below here we have a couple of related lists where we have uh logs and and you know this is where you would say you know i added a log or i started my cook uh things like that yeah it's a lot of fun um being able to to pair up two of our our the fun things in our lives doing servicenow development and uh smoking smoking the meat so uh yeah that was a fun yes yeah fun little discovery uh when uh we figured out we both liked both of those things um so yeah so our goal for today is really just to uh create one of these records and then i think i also want to create a log record um because one of my logs is like hey i started the fire um and this is actually important for me because i a lot of times figure out i forget how long it takes to start the fire and i never like lock it and so i kind of know it takes about 30 minutes but but then you forget sometimes yeah yeah um so uh that's that's what we'll do so the plan i think uh is i want to create a sub flow uh that's going to start it's going to create my cook record for me the nice thing about a subflow is i can call it from all sorts of places i could call it from a flow i could call it from a scripted rest api anywhere where i can code yeah so i could call it from a business rule or a client script or an external thing if i use a scripted rest api there's all sorts of ways to expose a subflow and you get to control what you pass into it and what comes out of the other end which makes it a a very script include if you're familiar with servicenow terms like object but you get to use it you know you get to use the flow top-down uh you know human-readable kind of uh process to do it versus scripting necessarily yeah and i would say at this point if you have something you're thinking about doing in a script include you might at least think about uh could i do this in a sub flow instead uh is this something that maybe at some point a citizen developer might want to pull into a flow um but you know it's i think it's time to start thinking like that like you know is this something that i could do in a subflow rather than putting in a script include and obviously you don't want to do that with everything uh but uh there are some things that make make sense nice so are we going to start with the flow the subflow we'll start with the subflow then we'll create our scripted rest api that calls the subflow and then we will then we'll test that uh and then we will uh call it from an apple shortcut uh sounds good it works getting my so that means showing on the screen brad is going to open up flow designer under our process automation area i am oh we're going to move into our correct scope i'm going to do that just uh just because just because after i i'm remembering it right now and then later on we're going to create a scripted rest api and i don't want to create a global one might forget by then because in flow designer i can uh you can tell yeah you can choose there but but it does default to the one that your main ui has selected yes uh so i am going to call this create cook okay and all right so this is going to create the cook record yes so before we jump into the different one that's going to create you log entries i think or do you want an abstraction that just accepts anything to your rest endpoint and does what you need from that like creates a cook or creates a log point yeah so i i think long term i'm going to have different shortcuts that have different like keywords that are going to ping my rest api and then the rest sure but you could have one rest api that's accepting those different keywords as a parameter that's that's a good point i do i do know that i want to do as little uh i want to do as little in the rest api as possible because maybe at some point i won't have to use a rest a scripted rest api anymore um okay so so let's do let's move forward with the create a cook then let's start like this um so for create cook i don't think we actually have any inputs um trying to think would would i want to know that i created it from like where i created it from i think you want to store that in the record like right so yeah you you do accept an input of at least you know which device is sending it because your apple shortcut process should be able to send like the name of the device that's sent it over yeah i think i can uh i think i can pass in parameters all right okay so let's pass in source uh i think that works as a string sure i thought and then one of the things we're going to use it as a string so yeah we are going to use it as a string um we'll want an output is there a scenario where i don't want to create uh a record um like if i already have one created and i tell it to create one not knowing that i already have one going at the moment no no i think you create a second one if it yeah let's do that uh so do we want an output let's let's uh i'd return the cis id and the uh num you know the record number all right is is what i would want from a returnable repeatable object here i'm going to call this yeah all right and let's see it is a beautiful day here in north carolina i've got the windows open it's nice we're a little warmer than we have been lately but it is still nice outside yeah it's 72 73 outside right now beautiful beautiful day all right so we've got my inputs and outputs there uh so now i want to just want to create a record yay we're going to do that on the cook table that's this one and then i know alphabetical is like the best way to like just defaultly present that but i sure would like the tables in my scope to be like at the top of that list yep i think that would be kind of nice yeah and then maybe most used tables and then like yes most used and then then alphabetical but somebody should put an idea in there somebody should um oh what if i don't need any records let's say i at least want to put a short description um we'll just say auto created from and then the device name yeah there's a reason we did that uh what other fields do we have on here yeah there's not a lot that you can pass in uh that's going to be different right so i suspect you might want to set some reasonable defaults yeah i i will probably want to do that just on the record itself yeah no no that's what i'm saying is like you might want to set some defaults on this table in those fields for like what the default should be yeah that's a good point let's do not do that in the subflow at all let's do one of those here um we'll do it later okay sounds good why did i not close outlook i don't need emails all right your emails can't touch me right now uh and then i'm gonna what i also want to do is i want to create another record yeah because i think typically when i do this it'll be when i'm starting the fire okay so and you can change it if you need but i can i think you know the defaults oh that's right i named it fire started i named that table such a good uh there we go vlog log just what the world needed another table yeah if you don't learn anything else don't don't name it name a table log so he's populating fields here and so he just grabbed the data object from that was generated from action one and dragged it into action two to leverage it uh i think that's about all i'm your friendly narrator today [Laughter] um yeah i don't think we need well time stamp is actually uh um no this this gets auto-created we're good yeah let's uh what do we have in here yeah pretty straightforward i'm going to put a put in and it's auto yes i approve all right and then let's set some outputs yep so we created the outputs and now we actually need to populate them with some data from the flow so that they can actually have stuff in them yeah this took me a little while to get used to adding an action to assign the outputs for whatever reason it just feels like i should i should have somewhere else to go do this but uh yeah it feels like i should do it in the input output definition area yeah to me yeah i it always like i always have to remember yes i need to do this in an action um quick record i want and uh the reason for it being down here versus up top brad is because you can actually do this more than once in a in a flow so you can assign the outputs at different stages so you could have branching or conditions in which you assign the outputs in a different way in manner and you wouldn't be able to do that if it was abstracted it that makes so much sense since there's no like variable you can just set to an output and then set that so yes that makes sense all right oh it doesn't does it not like that uh oh you know i called one of those uh i called this just cis id and it looks like it doesn't like that so okay let's uh oh yeah [Laughter] that's like a reserved word in programming eh don't don't use cis id as the name of uh let's read oh great oh no what just happened it got angry at you because all right just try and save it uh i'm gonna save you broke you broke brad's rule which is you took too long to save i actually had saved right before that i don't know if you if you saw that before that's how i got the uh the error because right but i thought yeah but that was after you've done three steps that's true i do typically say much more often than that yeah you did the inputs and outputs and three actions before you hit save which is which is definitely past the the brad point all right i think that looks good all right so let's save let's test this thing oh save successful source um testing flow design and testing all right see what happened it's all green that looks good uh let's get a number we've got a record outputs are these let's go let's make sure is that in a cook number and what looks right because this other one was 26 that that was 27. you could open the record right from your flow execution oh let's do that let's do that uh create record that was the second one yeah the runtime value is a clickable cook one zero two seven there we go hey auto creative from photos under test no time stamp though no time stamp what that should just be no that's the temperature record you thought that was auto done and uh apparently it's not but it's about to be gsa now should be yeah is now available on scope i don't know there's about 20 things that'll get you current time day time so whichever one works that looks really cool nice okay awesome well that's a subflow um right so we've got a subflow it's got nice in and outs um go ahead and put in a test default so that you don't have to pass that from your rest scripted yeah when you're trying to test it so go ahead and in your uh inputs under your inputs use that little drop down next to the oh that's right i always forget where that is um andrew says drink for success oh this message done that already but i'll do another one all right i'm liking my little pirate beer it's nice is it good yeah mine is uh i don't want to give it away but i'm still jealous of yours but it's gonna get a good score all right i'm going to publish this baby so one of the nice things here is you can use the little kebab in the top right to get how to call this from a scripted area under code snippet code snippet and you just copy this and there's even a button that just copy it at the bottom uh we're going to be on the server side oh i know i just wanted to look at it yeah so this is very handy that is nice i don't i don't know that i've actually used this before it's really handy when you want to call invoke a flow subflow or action from like a ui action so it makes it really easy to turn a ui action into business logic with uh with one of those i'm pretty sure the last time i did that i went to the apis on the dock side and and did it all grabbed the system i completely i completely believe that that's what happened i know that that i've done that more than once all right so uh i think i'm just gonna call this cooking management we'll give it some okay it seems long yeah it does seem long i'm actually just gonna call it cook for now i'm not gonna give it any protection policy no protection well that seems like a reasonable place to start and then hone it in later um yeah so then we want a resource and this is going to be create i think is what we will call it okay doesn't this get auto-populated no oh i'm thinking resource path um all right so let's go and paste in yeah and so this is where you get to decide whether you want this to run synchronously or asynchronously saw that note i want this to run asynchronously all right so then we comment outline eight or uncomment money and then comment uh what's that 11 and 12. no just 11. why do you look oh cuz it's all one because it yeah it doesn't do a break you could break it yeah that's fine there we go and yeah i think you do have to comment out 12. uh [Music] because you don't get results if you're running at async oh got it and then otherwise that looks uh well we don't have outputs yeah so it's basically you know take source and and go um you are gonna need to uh set the um so on line five is where you're gonna need to put the yes to grab the parameter from the other you know from the calling resource to here and then set your input of source yeah and you can start by just putting anything you want in there yeah let's hit test and make sure that oh no no uh that needs to say source sir oh it's it's so much harder when uh you're doing this on i on so yeah you can put any string there to test what we will send the source input field over in flow so we can save that and test it let's try it why did i do can i test from here uh i gotta go you have to go to the scripted rest api explorer yeah or the rest api explorer i didn't know if you had another uh another little trick for me no no i don't uh snc there might be a trick i just don't know that one i always just use the api explorer um did i not add a uh no you didn't add anything but that's fine because we hard-coded the parameter and we should uh yeah we don't we created a record the sign of the outputs right so but record 28 should exist now there we go auto created from test from strappy noise okay so now we need to uh you know add in that um yeah we want to grab the the source so you know we actually need to send the source as a query parameter and and then parse that and dump it into the variable where are you cook all right and then let's go can i use it like this i always forget i have to go look at uh oh you i i was literally going to look because i don't ever remember the syntax of how this stuff works and i've made many of the scripted rest api i just don't store it i think i can do this right so i will go pull one up and validate for you right now uh let's see and so in the relative path you throw in the little squigglies around the oh yeah the thing you want and then you do request.pathprams.the name of the squiggly thing got it so let's do this and could you use a something other than source yeah because source uh as a word scares me i agree b looks like we're back back no sound is there sound now looks like we're back all right uh looks like should be fine all right i think we're good uh we did call that that source on the flow so we have sound we do have sound um let's see you we're just going to see if this works i want to go cook management cook source hey there's something all right rest api explorer that is a that is a good source it seems right sounds right are you sure you want to do this why yes i am all right oh it's a graphql api i was hoping that was a shortcut for hey look at that and we got our we got our short description populated we got our log created we got the the description and the log populated properly that's looking pretty snazzy uh so now we need to set this up on your apple shortcuts to call this thing it's apple time all right it's apple time um i'm so nervous sharing my phone screen oh a software update is required to connect to brad's iphone uh i don't think i'm going to install an update uh right this second no this is what we'll do um join the zoom oh that's an idea that's how i share my mobile i was just gonna take a screen check cause there's not really much to it oh okay it's like uh legit you just copy the uh let's go back to the rest api explorer do we really have to do that let's let's see if uh if quicktime really cares yeah just because it said it doesn't mean it's [Laughter] new true recording and [Music] brad's iphone oh gave me the message again thanks for consistency apple i guess all right so cook management uh i am going to just uh i know this is riveting typing out on your phone typing in x this is like right at the point where i can probably still type it faster than i could send it to my phone yeah i say that and just fat finger at something so x underscore snc underscore cook is that where you're at right now underscore mgmt slash cook slash source i'm gonna say siri is my cook source and i'm gonna change my parameter to post and i just took a screenshot and we will uh maybe we'll post that or something once i scrub out my basic auth that i just realized i have here uh is it on your screen uh is the basic auth on the screen part of it is can you put it up to the camera so that i could see it and then we can flip to that real quick i mean you look you have a camera on uh i need to figure out yeah you can see all of the basic off so let's just uh i i typed that in it's just like a one thing show me what it looks like on your fine i just want to see where's can you see that oh yeah there's no way we can share that from your now so now i believe now i believe all right so i think it's going to work out so i'm going to go uh i'm gonna raise up my apple watch and we'll go start a cook okay ooh siri said okay siri said okay let's see she's on it hey auto created from siri twice uh i hit play one time does that look like right now uh that was a minute before so there was one right then and then one a minute before so i think when you saved it yeah i did accidentally hit it when i saved it so i can i can manually run it from my phone that worked so i'm doing it again right now and a couple seconds later come on pick up the event there we go there's the third one nice so that looked like it worked that totally works so i want to do another one that's uh adding we've got 15 minutes i want to add a that's some victory right that's a split i need a beer as good as your beer for this kind of victory it's really good so i'm watching brad drink this uh because we still have the cameras on even though you can't see them and i'm i'm just over here jealous i'm super jealous i'm like i want some of that i'm gonna have to go get a better beer i'm trying not to drink it too fast because the uh the abvs are are kind of out of [Laughter] control you said you want to do another flow yeah so i want to be able to tell siri hey uh i just added a split um which i think is the way i would say that uh so so that means it needs to your subfloor is going to need to look up in active cook and update it with a new log entry yeah okay cool let's do that we can do that uh so i think we'll just call this i forget we named the log entry log and we are also adding logs to the fire so i want to make this i want to make this generic um and then pass it that's why it's confusing yes um but i want to like i may add added fuel added wood so the snar start the cook one the reason you didn't make that generic is because there really is just start cook and end cook basically yeah so i started the cook the log one there's [Music] much more granularity in what we're going to do for that all right well that makes a lot of sense is one for start and stop which we can adjust that other one for stop and then this one for controlling the log entries i like that and keeping it abstract and accepting these as parameters um from from the siri invoked so this is we're calling this category uh-huh um like log category i think that's what i want to call it um and this is a choice it is but you don't actually care do you i don't yeah i wouldn't need to ever select it so it is this year i was i was thinking could i point this at a choice list but i guess i i don't need to point this on a choice list um and then the output i think that's the only image i don't think this one doesn't need i don't think this needs an output it's a one-way street create one of these things i got you man it's created let's do it all right so the first thing we need to do is look up a record yeah so we're gonna look up uh for an active cook you could use hookup record multiple records oh yeah that's right just trying to remember what the difference was uh cook i would hesit so if you're on a before paris instance use lookup records but if you're on a paris instance you can use lookup record because it actually returns the number of entries or does it not uh wasn't it did it it did something that you didn't want to happen i forget what that what that thing was right it did something bad like didn't do anything maybe all right so status is the updated thing got it okay so you check status um so it used to if you did a lookup record and you didn't find one it aired and your flow stopped but now it content it doesn't it'll throw an error message that you can consume but it doesn't stop your flow all right yeah i think i want work in progress flows well we we do want activists active and true is true is very nice on pretty much any table to just speed up queries uh work in progress i think that's the only yeah we've kept this uh show pretty uh lightweight on the uh how deep you can go i'm gonna drop a little knowledge bomb performance wise if you start your query with the thing that will reduce it the most it will actually speed up your query so the order of your conditions actually can matter performance wise so active is true is a really nice thing to start with because that's super well indexed and narrows down most tables very fast and then just in case i have more than one i want the newest one here well that makes sense and so you see there's some new things here in paris which is if multiple records are found do this um so you got some choices on how to handle um this this scenario all right so we've got a cook record from that and now we want to create a log record so this is on the log record we may be adding a log we don't know okay cook is cook record and then our category is coming from our inputs it's going to be log category and then you gotta throw in there is nothing else that's right those folks that are you know oh so do we want to uh do we should we accept a source from this too um do you care at this stage yeah that's a good question do i care if i just did a i don't think i care i don't think i care now i care that the cook and the initial log was created from automation but once a cook is in progress like whichever device tells me to do a thing just just do it i have thought about adding some automation to my outdoor space to where whenever i like open the door of my cooking chamber i i have something that triggers something and creates a record here nice so oh we should totally do we use that yeah oh there's some heat issues but i think i can still make it happen like i like i think hey why'd you open the firebox door 27 times in in a minute here don't be so impatient yeah we we could definitely rig up a little sensor that kicks that off oh i totally want to do that now i've been thinking about they have those little amazon buttons also and i've thought about putting one out there to to do something with whether it's anytime i add a log i could just hit the button oh well that's cool uh for your opening the door or not i was thinking uh like just a contact point sensor yeah that you know is in contact when the thing is closed and it breaks contact as soon as you lift it up and you know sends it to a little uh you know controller that can then hit your rest api i actually would like to know like the times that i because sometimes i do get i do get real impatient and open that door a whole bunch of times and i i would like to know if it actually affects the temperatures of course it does it not only does it affect the temperature it affects your cook it affects the results yeah they say that i i would like to i'd like to get some data from it it is a little more forgiving than a cake in a you know oven but yes but it's still you know it's and it's the firebox door so the the you know cooking chamber is still i don't open that very much it's the firebox that i like to mess with oh i got confused then i thought you were talking about opening the cooking chamber i mean if you're gonna put sensors on something you might as well do it on both on both sides yeah that's but uh that is what i was saying all right back back back on track uh so this is i'm having too much fun this is going i'm i'm gonna go order some sensors and send them to brad's house um yeah an arduino is what i was thinking uh andrew all right so oh i favorited this let's get my cook so i want another resource and this is going to be add vlog at some point i'm going to rename some of this but not today all right so this one for the relative path i'm going to want cook category okay let's save this guy and he's angry didn't you want to i didn't you want to like uh what was the you use like um you need a prefix on that right yes category could be the same as source that's why it's because cook category and source at the same end point they couldn't do the same thing over yeah so this i need uh some i need something in the to say you needed to like end it management and do cook slash or do log like if you moved it up one level and then the other one was cook and then it's parameter and then this one was log and its parameter do you understand what i'm saying the resource path should end at management well i think i have to give i this was auto created right from the i think i have to edit the relative from cook um yeah so that then you need the api itself add log to the second one i think i think i'm gonna add well yeah we've this is already working so let's add uh will that work i think i need to add like new new cook or something to this right oh create i don't like that either how about that's an action not a right because this is the create cook i think you should do uh resource stuff instead of new cook let's just do um cook again or cook record or cook like cook something path is always going to do a create because it's only existing in this resource which is doing a create oh okay um yeah that's fine then yes sorry no i was thinking of the create and the the you know the create a new one and close it oh got it okay if we were to do both from the same yeah that can be a separate uh resource method so this will be what did i call that new or create new new underscore category all right and i think we're almost out of time so we won't do this from the uh we'll just test it from here why don't you legit copy the other one and paste it here and just change the path [Laughter] we've already done all the work i think we can actually close this out if you just copy this one and paste it over in the other one and adjust just a little bit all right and the difference is i think i had lost this yeah versus create cook there you go nice the parameter yep log category okay yeah this is what did i call this yeah look at the flow oh it has it has it there but yeah lovely i bet you that'll work oh andrew guarantees [Laughter] upside down andrew guarantees andrew is uh maybe oh nope i have to click on the other one so um we need to pass it i don't i don't remember what those are called yeah you're not here to defend yourselves andrew so i said you said that prove me wrong andrew mayer may not have been invited to this uh also let's go at it he's fueled just now he guarantees it i saw i saw all those words it was in the chat added fuel is what we want all right let's see how the upside down andrew guarantee works now one of the fun things i didn't point out is you can actually launch the rest api explorer from inside your rest api method i thought that was available i didn't see it in there i didn't see it when you were you know what oh that's not the one so our category didn't get passed well let's take a look at that entry and see what is in there show me the xml all right so we made a mistake in our parsing we did go fast on that parsing yeah i think we're out of time but let's uh yeah category log category you know maybe if we just named things the right way that would i'm not going to rename those things but i think that was it um what should the category be added fuel all right it's gonna work this time okay let's do it because i know you can get from the rest api explorer to the to the entry okay let's see so many clicking hey that was it all right victory was had yep screen share was stopped that was i'm on the wrong screen that is that doesn't look great what happened oh it's so angry why are you so if i am i can you see me up here there we go you're good now i'll go back from i don't know why i was angry but it was wow i was angry that was a lot of fun brad so what you did was you um we created two subflows that uh one of them creates a new cook record and creates a log record which is a related list item for that uh and the second one the the second subflow creates a log entry for an existing cook and both of those can be done through your apple shortcuts which can be invoked from siri on devices like your um wristwatch uh and it was very simple to set up on your phone i've not done that myself but you know looking at your screen i was like oh you just put the endpoint in there yeah it was really just put type in the endpoint type in your authentication or copy in your authentication and and that's it the nice thing about what we set up too is you know i've got i have a lot of apple devices we've also got some like google home devices so if i figure out how to consume a rest endpoint from our google devices i can do that from there and then the kids can make fun of me when i try to when i try to do apple devices hey google they get a kick out of that which i'll not confirm how often i do that but that's pretty fun um so that was that was really a lot of fun and in order to do that we needed a scripted rest api that could be our sort of external touch point for your apple devices to call and then that in turn just invoked your subflow which then did any of the logic uh that we needed in this case um and it it went really well um we did not practice this i mean we have done some similar sorts of things before but this was not a polished practice demo and you nailed it brad so that was really great um that you know that yeah that was some victory i mean the just the the power of sub flows in flow designer is you know it's so powerful you know put everything you can in a sub flow and then you can call it from the flow or wherever you want to call it from i think that's my new default rule as a developer is whatever i'm working in flow designer the things i'm creating is either a flow a subflow or an action and then how i invoke that might be a flow but that's a separate endeavor like i build my i construct my uh work objects in that subflow or action and then i just i just call them from the a very simple flow with a trigger or it once you're on paris kinds of things you can do that from process automation designer i mean it's really similar to thinking about business rules and script includes i mean you know really you should be doing any anything serious in a script include and then just figuring out how to trigger that script include whether it's from a business rule or workflow script or wherever too much fun thanks brad so how was your tasty beverage today sir i'm calling it a four five just from looking at the thing it was really good and it is uh it is a four five so it was the lion's share anniversary ale uh from lakewood brewing it was kind of unique it was a little different than a lot of the i do a lot of barrel-aged stouts and this one was a little different so i liked that nice and my pirate lovely beer um which is uh too much fun from belgium and it's a belgian ale uh was quite good for belgium um i think it's getting some victory points uh and i call it a two four two five nice cause it got some victory points um but i sure wish i was drinking a uh rum a rum barrel aged uh stout of some form it's getting you know it's not cold today but it's getting cold and i can break out those stouts soon well thank you for joining us everyone um you know if you're watching us live on friday we'd love to have you you know in the chat uh if you're catching us later come come join in the chat sometime we would love to interact with you directly or visit us on the blog developer.servicenow.com our blog lives there and we love to to interact with all of you developers out there in the world and uh let us know what what you'd like to see coming up in the future uh so you know reach out to us directly twitter linkedin what whatever get us a message send up a smoke signal tell us what you want to see and we'll build it craft it create it on the show here anything else uh from you brad before we close it out not from me just hope everybody has a great weekend all right well thanks everybody have a most wonderful weekend and we'll see you again next time [Music] you

View original source

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