logo

NJP

NOWCommunity Live Stream - Topical Deep Dive - (Re)Building the Loaner Request App

Import · Jun 04, 2020 · video

[Music] good morning good afternoon good evening wherever you are and whenever you are welcome to the community live stream this is June 4th 2020 and I am Chuck Tomasi senior developer evangelist happy to be here bringing you another deep technical deep dive topic this time I'm going into a request from one of our customers that said hey Chuck we're looking at your loaner request app but we're not allowed to download it from share because it's not technically created by ServiceNow however they do have the capability to create their own apps so here how did you build it I said I'll do you one better because the last build that's on share is now four years old needs an update and I'll get to it eventually but I said let me show you how I would build it if I were going to build it today because a lot of these capabilities weren't around in 2016 flow designer for example the native mobile app good morning everybody who's IT and thank you for joining me so that is our topic for today and I want to go through there's a lot of content to do so I want to go through this real quick remember to subscribe like click the notifications on YouTube the URLs right there go ahead and subscribe we appreciate it we're coming up on 10,000 subscribers to the community channel so very excited about that we also do this on twitch over at twitch.tv slash now community if you prefer watching there or if you're having some issue with the video feed fingers crossed that nothing happens today there's always some gremlins in the network that make things interesting and knowledge is still going over at knowledge dead ServiceNow comm we had a wonderful keynote yesterday the with bill McDermott and CJ Desai and lots of customers it was it was a wonderful wonderful keynote had a great time watching that and it was it was a fun time but there's still more content coming out in knowledge I encourage you to go although the previous stuff is available on demand so lots of content out there waiting for you if you go check that out and a real quick reminder that on the 23rd yes the 23rd at 8 a.m. Pacific time we've got a webinar coming out on more things about flow designer and integration hub Michael slobotnik who I think has been dubbed our flow master which I'm not sure if that sounds good or not you decide we'll be covering all of the updates that we've made in the last three releases so that would be Orlando New York and Madrid lots of stuff has come out in those and even more coming out in Paris as I start to dig into that content I do have a Java Script series we will be covering a little bit of scripting here and this I got ahead of myself a little bit go over there if you want to learn more about Java scripting and the snippets that I have will be available on github immediately following this broadcast at that length they'll be in a folder with today's date 2020 - oh 6 - oh 4 you'll find everything from the conditions we put on a UI action to a full-blown script included that does a lot of the deeper logic so let's get started and my introduction to this topic I'm going to go to my instance here these are should mention these are inspired by your content Oh before I begin I want to take just a real quick personal moment and I gotta do this so you can see it better my team wonderful team at ServiceNow worked with our CEO Bill McDermott some of you may have seen this book that bill wrote prior to coming to ServiceNow my team worked on getting me a couple of things this Sunday is my 10-year ServiceNow anniversary very proud and pleased of that fact to have been around for so long through such a changing company they worked with Bill to get a personalized signed copy of his book well that does interesting things of the green screen it gets that and even better the a signed picture us together so I was blown away when that showed up but very very happy to have received that and can't say enough about how happy I am to be at ServiceNow for 10 years on a wonderful team working with such a great in many ways I know there's over eleven thousand employees now and it still feels like it's the 150 hundred and seventy five I had when I started so just can't tell you how amped up I am today and to be able to bring you this topic so thank you very much to everybody who's involved okay lots of information here this actually builds on I was coincidentally our demo Center we have a demo Center where we do regular demos if you want to go see performance analytics all right Tom or sac ops or whatever we have regular demos that are presented live Q&A you can join those look for those right off of our main page I think there's a button that says look for a demo or get a demo or something like that it's that little flyout over on the on the side of the page I'd go there but I'm in a hurry anyway this builds on it Alex she he did the first part of this she built the table she did the form layout you did the list layout I am going to skip over that because that was 30 minutes and she had to slow down and talk about it I figure all of you know how to make a quick simple table how to make a related list that kind of thing if you want to see that in action go ahead so what I've got is a loaner request application this is directly tied to what I built as a customer a little over ten years ago and what got me the innovation of the Year award at knowledge 10 and subsequently led to my onboarding and it still lives on in demo Center demos if you've taken the appdev course you've built this yourself so you know what pieces and parts are in there it has been updated it's available on share but as I mentioned that version is now four years old and it needs an update so I'm going to show you what it takes to build this so my friends in the federal space my friends in the finance space who don't have the ability to do download from share can then build this and other applications this is a great example of what we call an extension app it extends ITSM because it's making use of the CMDB so I'll go through and show you what I built real quickly there's a simple request table extended from task in fact I will go to studio and show you the pieces and parts that have been built I started in guided app creator and checked the box that said or click highlighted the icon that said mobile so it built out some mobile components for me I am going to leverage that but not I am going to start an applet from scratch we'll get into that in just a little bit so I've got a loaner request simple table extended from task I added a couple of fields one is a Depot to say where would you like to pick this up because this is multi-site capable so here is the Depot and I put in some choices nothing special there I have an item type which is simple choice lists there's only one item type to pick here and it is laptop and I want to show you something interesting that I did for the item type I didn't just put in the word laptop and have it Auto populate the value laptop this is key to getting the filtering later so let me show you the choice list for the item type notice the value right here is actually a table name it's a class because I'm going to start filtering on that type of asset is it available in this Depot are there any other requests for that thing that's going to come in very very powerful in a little bit but for now people just say hey I need a laptop the label and the value are distinctly different for a reason the item is my good old configuration item I just relabeled it because you know most end-users don't know what a configuration item is but they know what a laptop is they know what a phone is they know what a projector is they know what a vehicle is this could be extended out so let me I also created a related list of tasks so any one of these could have an Associated process with it that has subtasks for example when a loner is ready to check out we want to do a safety a sanity check on it make sure that the screen isn't cracked make sure that the cables are there make sure they've got a spare Mouse whatever the request asked for and then when it comes back we'll build that flow out in just a few minutes so stick with me on that the other things I have built are two fields on the CMDB CI table itself and part of the reason I pre-built this is because that part takes a while because it's going through and adding that field to every table so I added this one is called is loner and it is a boolean true/false and then another one is called Depot this is just the same choice list in fact this choice list references the one off of I think I've shown this to you on other CLS episodes it references the choices on the other table so if I add another site it automatically gets populated here this is to say this laptop is in this location you could see I've kind of got these named intentionally - in Chicago the depot is Chicago - in London the Depot is London okay not unlike something that many of you do in your organization's all right so that's what I've built what we're going to do today is finish some of the UI UX stuff the user experience on this right now it is a table of Records there's no smarts behind this we want to put some smarts behind it so that it's easier to use okay so I'm going to put some UI X stuff on it a couple of workflows and I'll number I'm not going to build the entire thing I'll give you the options of what else I would build if I had a few more hours now again getting to this point took about 30 minutes it really wasn't a lot of time building the rest of it would take I'd have a Minimum Viable Product out in about a week that includes the time debugging the scripting that I wrote already so we'll build a couple of workflows one to manage a linear laptop process and one to do a schedule check to say hey it's time to bring you back your laptop hey it's time to bring you back your laptop hey is time to bring back your laptop let's go I'll add some reports I'll do a little bit of script as I mentioned to improve the deeper logic we'll and hence the mobile experience and let's get started okay that's what I'm up for hope you're up for two and and I'm gonna have to move pretty quickly so first thing I want to do to improve the user experience is create a better way for users to create a new request right now if you create a new request you're looking at what could be interpreted as an IRS tax form okay it's busy they don't know who it's being assigned to they don't know all these types we want to ask them for the minimum amount of information so in studio I'll click my loaner request table and apologize this is a repeat of what Alex covered yesterday but it I love this feature it was one of my favorites as a customer and I use it all the time going to go down here to where it says add to service catalogue this is going to create for me what's called a record producer and I'm going to create a loaner request thank you for autocomplete having done this demo a couple of times let me get my fat head out of the way gee I didn't even see that okay sorry about that my head was in the way pardon so hopefully I didn't obscure too much tables forms list layout I can oh look at the monitor up there once in a while okay back up where was I I went to loaner request down on the links related links add to service catalogue there we are loaner request give it a description borrow temporary asset put it in a category this is where it will show up in the Service Catalog whether it is directly from the classic UI on platform or from service portal it will get here then I'm going to pick a few fields that I want on there I don't need all the fields in fact what I'm going to choose is more than what Alex chose so I tend we don't need approval history try that again I need a start and end time when do you need this it's a lot like renting a car remember when we used to rent cars now we just call it a ride share okay I don't know when the last wait I did rent a car last August the let's also get the depot where they want to pick it up we'll get some additional notes in the description field we need who opened it opened by not opened and the item type they're looking for now those aren't exactly in the best order so let's start with who is this for we'll get to the description is a bigger text field we'll put that at the bottom what would you like to borrow I can do a little rearranging here it doesn't take a whole lot of time and about a boom bada bing I'm done click save and open and that does quite a bit for me now if I were going to create a record producer like I did in 2010 it would take a few more minutes this didn't exist back in 2010 so very handy wait for the forum to reload wait for the forum to refresh there we go I get caught by that every time and down on the bottom it mapped those fields directly to variables in the record producer but the cool thing this is one of the things I love about record producers is you can change these from boring old field names to something that makes more sense who is this request for who is requesting this when would you like to get it real questions I'll just do one here is a sample but you could put in other more verbose prompts to make more easy more customer experience better that was terrible English but work with it ok and if I drill in here I can do one other thing I can set the default value to whoever is at the browser at the moment who logged in you may have an admin assistant for an executive that is filling it out in their behalf I need a laptop I need a projector I need a mobile owning your vehicle I need whatever it is you're loaning out they can override it but I want a default value so I don't have to pick my name every time so let's put that in that is one of the first little bits of script I learned in ServiceNow and that is let me zoom in on that for you javascript GS get user ID that takes mysociety and saves it right there ok let's zoom that back out so when I look at that field I can actually go try this right now let's go now to the community let's go to the service catalog pop that out go to service catalog and can we help you is right here got it and there's my loaner request near the top and it's already filled out with my name with a wonderful wonderful prompt lets get that I'm going to reserve this from tomorrow at 7:15 a.m. I'll bring it back Monday at 7:15 a.m. I want a laptop from Chicago and the description is please here does it come with a bow tie okay I just there's my request dates filled out times filled out none of the crazy stuff that I don't need to know what the item is yet because I'm not picking it much like I don't pick a car until I get to the counter they say do you want to upsize maybe you could put that into your algorithm do you want to supersize it get some money out of it I've got some read-only fields here for reminders when did I remind them to pick it up when I remember to bring it back when did I remind them it's overdue if that ever happens and I've got my description in here okay but right now the item field has a very simple filter on it it is only looking for items that are is loner is true so I've got eight items you saw them before that's not necessarily true of what's available in Chicago at this time I will get to that in just a second just wanted to point that out it's got a very simple filter on it and it's not doing the job before I get there I want to go to show you one other quick thing that is not used all that often or at least not enough maybe you use it more than I do but if I go to because let me back up because this table is extended from tasks I have visual tasks boards available to me so if you're ever in doubt about when to extend and task and when not to err on the side of doubt err err on the side of caution get those extra features like VTB because now I can go to any column you like a choice list or a reference field and say create a visual task board for me and here is my visual task board with the current assignments and if I want to take something that's not assigned and simply not the whole lane Charles assign that to David Lu I can go over and see that my request or Chuck in Chicago is in fact now assigned to you where is my request which one was open for the June 4th did I lose it I thought I was in here I'm not let me back that down I'm not able to see enough so I was opened by me show matching it was open today you think it would have the highest number six two two six six I needed six four nope there it is six five two six eight it's one thousand two okay I have to one thousand two is because I started the numbering over when the last time I imported this so yes I would need to go fix that okay so there is one thousand two and because I can oh I did secure that field but I had it read only anyway we're going to remember that this one for David Lou is there vt bees very handy now there's one other thing that I want to do for the agents that make this a little more pleasant you can see if you look very very closely there's one request that's overdue okay how do you know because the state is going to be checked out and the date it should be returned right there is in the past its before now and I keep that expression in mind because it's going to come back a number of times what I would like to do is just put some sure a red dot or cell or flag this from the list that is overdue so is anyone glancing at this can know that it's overdue that's very easy to do with a field style and I did a number of these in the original app it's still there so I go into the form and I right-click this or I could do this there studio but I'm showing you a couple of different ways and here is configure styles I click new and because that encoded query is already there it knows what field it knows what table all I have to do is use that same expression now I'm going to borrow this I did write this earlier so I don't have any typos this is my field style overdue expression again starting with JavaScript this condition has a value I'm not going to put in a literal value of the date otherwise it would always be now and six weeks from now that wouldn't be any good so this lets me create something more dynamic let me tap into that a little closer scoot that over so you can see it nice and up close JavaScript : the current work end is less than GS minutes ago zero that's now anything that is minutes ago zero is now and the state is 14 I know the state because I looked at the state field and said what is checked out that's 14 right so that is my expression oh I forgot to put a color in there the only attribute the only style you can put in is that didn't go as big that's interesting let's go back to big there we go nice and big I want to show this to you background color and let's pick our red color one of my favorites tomato and because of motor skills I can't spell tomato without first starting to spell Tomasi because I type my name a lot faster and a lot more often than I do tomato tomatoes a nice red color doesn't burn the retinas when you see it on the list it gives me a little sample and if I go back to loaner all I now have a red dot and if you go to the gear icon up in the list let me show you where that was again gear icon up here you could turn off modern cell editing down here and it will be solid if you prefer that style that will carry over to all of your lists though so be aware of that so red dot visual indicator we're good we're handing the user experience a little bit more for the agents one more thing that I want to point out and that is we have some items that are requested like this one has been requested since May 11th ok it's still requested it hasn't been picked up it hasn't been fulfilled this person clearly forgot about it we need some sort of canceling you can see my state button is read-only for a reason I want workflows and I want you I actions and I want other things to move that through the states so that we don't get agents and users moving things backwards and forwards and making a complete mess of the process so I am going to create a UI action so let's go to studio I'll make that a little bigger we're going to go to server development UI action and collapse this because we don't need it at the moment I'm going to call mine cancel that's the name that will show up on the field and with that it will show up on the button I want to make this a button I miss that once I'm going to give it an action name also and this is important because it's going to be referenced from the script you don't always need this field but when you are using it please if you are using client scripts you got to use that I'm gonna make it destructive so it's easy to see that it's read for a cancel and it's only going to exist on the form but I also forgot I said client I checked that box and up comes the on click button which will call my script function my client side this is going to be one of those mixed ones where it's client side and server side together my condition I already wrote over here UI x and x condition let's paste that in there and what it says is if this is an active request and it was opened by whomever is driving the browser me or this person has the loaner admin role ok so you've got to have some privilege or the owner to do this and it's got to be active but if it's completed or cancelled I don't want to see this button it means absolutely nothing let's go and get my script I'm gonna walk you through this real quick the script goes like this get to the top of the script it starts out with the cancel function actually is probably a little easier to see here but put files away we can see it here all unhighlight this starts out with the cancel because that's what I said what to do when you click it has a confirm it says are you sure you want to cancel this request if you say no it will jump down here and abort the submission if you say yes it will do whatever is in here and say have a nice day I'm going to submit this form and notice right there there's our loaner cancel that's the action name what do you want to do on the server side it comes down here and says I'm going to run this part of the code cancel any workflows from flow designer that are running this part took a little research not much but I needed to know what the flow API was to cancel any running flows I'm cancelling this it's dead I don't need the flows and then sets the state to four which is its old updates the record sends a message and stays on the page that's what my script does I'm going to submit that let's go test it to see how I did not the community I should probably just close that page so I don't keep doing that let's go back to our loaner and I think I was going to kill number three yes that's the one that's been around since May there's my nice button it says are you sure if I hit cancel I can go on my merry way right oh I accidentally hit cancel instead of update because look how close those are together bad design okay don't do that you may want to put cancel under the farm menu but for display purposes I'm putting it out here cancel okay it said there are no flows these messages show up once to say I'm creating you some privileges and oh by the way I cancel your request look there it is it's no longer canceled and the cancel button is gone I don't need it it's canceled a little more you asked experience you can do more menu options you can do more of these it's very easy to create granted the script probably took me an hour to write okay so I'm just giving you some TMI on some of this stuff let's go and make a couple of flows because flow designer was not out last time I did this in 2016 very powerful feature in the plot for creating these workflows I did the original with the old legacy workflow and worked okay there were some more challenges but I'm going to create a new flow and walk you through what this looks like let's just call this loaner laptop it is going to be specific to the laptops because I may have a different process to prepare phones projectors vehicles there may be something I need to do there so let's set our trigger to anytime one of the loaner records is updated loaner request updated and put a filter on there because I only want this to trigger when the item type is laptop don't have much of a choice there but I do have a choice of leaving it off and the state is reserved yeah so requested I'm going under the premise of the old hey you want something but it may need an approval it may need I may need something assigned you you can't just do this because I don't have the CI I don't have everything I need until it's reserved then it's locked in it says you are getting this thing so let's say it's reserved I say save there and just for personal benefit I'm saying saved there now what do we do when it's reserved well I stick around and wait until we don't need to do a lot of tasks and if it's if it's still unavailable I mean if it's if it's not time yet so the first thing I want to do is wait a duration of time so let's wait for a duration of time which is under flow logic and this is my process so I'm going to say 72 hours relative before the actual start date I have to scroll a little bit because my font is so large for you here is the request and here is the actual start so just hang out chill just do whatever you want until 72 hours before this request now somebody put something in 24 hours before the request it's fine it'll fall right through this ago yep we're there but if it's two weeks ahead of time it's just gonna hang out then 72 hours before it's going to say what do we need to do well let's move this request so we'll do an update record from take the record drop it in there it automatically populates my table I'm going to change the state that's all I'm going to do is advance this through its process the state will go from reserved to prep I want to prepare this thing to get prepared what does that mean it means I need a task for somebody to actually do something so instead of create record I want to create task this is a little different because it offers me one feature that I absolutely love first I picked the table loner task that's why I have a sub task related to the loner request so I can do these workflow tasks and see them they may be assigned to different people they may be happening in parallel we don't know first thing you do whenever you create a sub task is always related to the parent this is so easy to forget and it is related to notice I've got a record here and a record here when you're using flow designer always almost always take the latest copy because the trigger record could be in a different state it could be have different variables and values you typically want the latest and greatest so I'm taking tool owner request not trigger loner request I notice this checkbox down here this is wait this is what says stop the flow until this is no longer active until it's done until it's closed that way my flow doesn't just fall through and go into a whole bunch of states amazing whole bunch of tasks there you go no I want to do this in a linear fashion and pause that's what the wait is for next thing I'll do is make a short description and you know how to use the data pill picker to get things in here set up laptop and I can drill in using the data pill picker if I wish to get the laptop name update record loaner request record I thumb drill in there and get the name that way would show up in the short description there is name standard data pill picker stuff I can do the same thing with the assigned two maybe we'll just assign it to the parent assigned to so I can give you that get the loner assigned to it's pretty close by so I can just pick it off the panel setting up my child tasks for what it needs to do it's going to sit around and wait notice these are pretty poor descriptions this is where I would use the annotations a lot state equals prep a create prep task be kind to your future self create a task once that task is done then it's ready to pick up so back to good old update record where you use this all locked up date record which record of my updating the latest and greatest loaner record that I've got drop that in there fills out the table state is ready to pick up it that's going to send somebody a notification there probably another flow haven't built that but you can imagine what that looks like ready to pick up I ain't my done no I should probably put a comment in here state equals ready to pick up this was so much more complex with a series of scheduled jobs and scripts before so much easier now that it's done in flow hey then after it's ready to pick up I am just going to sit around I mean assuming somebody checks it out picks it up uses it they're going to bring it back or I'm going to get it back at some point and I'll show you how this piece advances when I get to the mobile section but I am going to wait for a condition wait wait for condition what am I waiting for I'm waiting for that request record to go from checked out to post so I take my latest and greatest loaner request record and I'm going to wait for the state that's a little far down to read state is post okay we're just gonna again flow is gonna hang out do whatever it's gonna do once it gets to post we're going to you got it create another sub task create task there it is same kind of thing I'm going to take the table loaner request tasks I'm not going to flesh this one out as much as I did before but we will create the loaner request parent as the latest and greatest wait for that to be finished again assigned to short description full description you put whatever you want in there let's do this create post deployment task and finally when the technician has done checking it in making sure the left top screen is not cracked etc etc we are going to do one final update record on the loaner request and you guessed it it's not the loner task where's my latest number four not add another one there I am just simply going to set the state to done it is complete it is gone it is done did I remember to do a wait on that one yes I get a wait on that one okay one more comment set state equals complete alright I am NOT going to test this at the moment just for the sake of time I'm looking at the clock going it's flying by very very quickly but I'd like to show you another flow that gets into a few other capabilities that have been added recently this is wonderful stuff and very easy to do at this point I would test it activate it make sure that my tasks go let's go and create one more flow this is going to be a scheduled flow every hour every night every day every week however much you want so let's do loaner overdue reminder you know when we run this is a script this used to be a series of snow this is one of several scheduled jobs in the old version a little bit of script okay a lot a bit of script to do this and it worked it relied heavily on a script include not bad that's good so instead of doing a record updated let's say daily or maybe hourly that would be fun repeat every one hour okay you can run this as often as you want I probably wouldn't run it every second what is zero in there all right my mouse is falling off the desk so every hour I'm going to check are there any overdue things if so what are we going to do about that we are going to do a lookup record so let's go and get all the records that are overdue look up there's lookup record and there's lookup records okay make sure you get the right one we want lots of records and I'm going to go to the loaner request table and here comes that expression I told you to keep in mind where the state is checked out and the actual end is at or before the current minute now sometimes you will see this as a little calendar like picker sometimes you will see it as a full drop-down but either way you're looking for current minute that says it's overdue go get me up to a thousand hopefully I don't have a thousand overdue items or I'm in really serious trouble once I've got a list of records let's iterate through them there with a for each and I will take my list of records and that is one of the easiest activities you can you actions you can use on flow designer then I go into this branch for each item first thing I want to do is send an email and email and I'm going to tell this person hey your stuff is overdue so I take the record drop it in there fills out the table I'm going to send it to whomever is in the for each lookup record opened by now I thought you could just drop in open by you can't you have to go to the email because it's looking for an email address and our subject could be overdue item again data pills to make it prettier put in the laptop name please send it back or we will send out our enforcer you may have friendlier messages than I do what you get for growing up in an Italian family I guess let's mark that as done once I've sent the email I want to update the record remember the loader record it had some reminder fields down here I want to set the last reminder and the overdue count when was the last time everyone did this this is gonna come up on reports how many times did I have to nag somebody before they got it back well good old update record can help us with that update record and as we continue to build out flow designer features we have a couple that I'm waiting for that don't exist yet today so hopefully we'll get these soon but for now I have to do them myself let's set the field overdue reminder too right now and let's set the overdue count to increment okay there isn't a right now data pill or something I can pick so what I'm going to use is this little FX right here to make a zoom in on that for you right there next to the field that says I am going to write a tiny little bit of script and the tiny little bit of script was pre baked it is a whole two lines let me get that for you flow designer current time it says go get me a glide date time object and give me the display value and that is right now okay the variable now doesn't mean anything I could call the T I could have called it Chuck I could have called it CLS doesn't matter but putting that display value into that field is what does the magic for me and I close this up don't hit the FX button it'll turn the function off just collapse it okay and it will stay light it up and say this is going to come from a function the next one I'm going to do for the overdue count is just slightly more complex because I'm checking for a number of conditions it says go get the data pill from a previous action and if it's a number I am going to incur if not I'm going to initialize it so this part right here may look new to you but you can actually see in the comments if you need to get something it's FD data something something something and I got that by saying FD under data dot and you've got oh look which action do I need it from I need it from thee for each that would be to dot what do you need there item dot and I can find my overdue count okay that's how I got that not any great magic I parse it to see if it's an integer if it comes up empty I initialize it to zero and then increment it and return the count simple little script not too difficult this is a low code exercise I'm done with that that's all I've got let's save it I'm going to pull up my wonderful wonderful overdue item that is checked out let's go to loaner all and thanks to that happy little red dot I know exactly which record it is it's this one and I'm going to keep an eye on that as I test this it doesn't have any inputs because it's a scheduled task I run it and sure enough it says I've told you once right now sent you an email please bring your thing back otherwise we'll send out our enforcer so flow designer makes it very easy other things you may want to consider for flow designer a manager approves laptops that are available only in Sydney ok there's going to be certain rules that come up like that 24 hours before the actual start send a pickup notification and update the record there's another field there update for the pickup notification was sent 24 hours before the actual end send a return hey your thing is due back in 24 hours you might want to bring it back tomorrow it those would be some other options you could use for flow real quick I want to show you a couple of reports things that I have built that I found useful reporting in ServiceNow is very easy I know you've probably seen reports before but for this use case when somebody says hey how did you build this I'm going to show you how I built a couple of the reports that I did so in studio first I'm going to create a single score report to show the number of overdue items quick reminder of how many things we have out there that should be back by this time so let's call this overdue items going to come from a table you guessed it it's our favorite loaner request table let make that just a little smaller so that it renders a bit better go next what type would you like I want a single score record I'm sure how single gets a pivot table but go to the next I'm going to count records pretty similar style oh let's make this nice and red okay we refresh that and we have eight we do not have eight overdue items we suffer the list we have one overdue item which means our condition right here needs a little bit of work so let's fix that condition up and what do you think it is that's right it's the same condition we had before state is checked out and actual end is at or before datepicker minutes current minute rerun that rerun that let's save it first and it will refresh automatically we have one overdue item in red and of course like all other reports it's clickable I can drill through and see the records that are behind this very simple report let's do another one let's do a calendar of where these reservations are because that's often handy alright report I could put these reports on a dashboard I can organize them you send them out as email whatever you want of course once you send him out his email it's obsolete I don't I don't find a whole lot of use in that so the loaner calendar there we are same table I want to get requests from fine don't tell me oh it's right up there at the top it went up instead of down as used to that thing coming down type of report calendar and this time it's going to say what date field do you want me to focus on what field you want me to snooze as the start and end I want this actual start field to be the key trigger to that and that is about all I have to do for that except when i refresh it's got a couple of things on here remember that one I cancelled it's still on here so we don't need cancelled but we would like things in the past you you make up your own filter but for my my filter I'm going to just say it's not canceled if that's all I want is to get the cancelled ones off of there because they really don't provide any value on a calendar I run that I save this and I notice something right away if you look down here loner tenda a 1008 and 1007 are both looking for the same resource that's because there's no smarts behind this there's no intelligence so what I'm going to do is add some intelligence real quickly using a quick script a reference qualify modem smarten up that reference qualifier if I can get this to unzoom on me alright fine we'll just reload studio and it's still zoom get there and what I need is a couple of scripts I call these script includes these are libraries on the server-side that run on demand first one I'm going to create is one of my new favorite design mechanisms called a constants folder and all that goes in there is a list of tables and properties so that I can pull them out by name I don't remember the exact table name which gets a little confusing when you're dealing with multiple scopes so I just pop them in here and I know this is my request table this is my other thing I do have a property in there that points to the CI field that gets determines what my active States for CI and I will walk you through this and I'm looking at the time it's going faster than I expected let's create another one that actually has the the real logic in here that does all of the work this one is called a loner util and like a good baking show I have this pre baked but going through it in Reverse this is what I want to do I have an advanced reference CI qualifier which needs to create an coded query that says filter on just these records how do I get that well I need to call that from the dictionary I will get to that in a moment the the item field needs a filter on it right now it is a very simple filter I'm going to make it a little more complex with this it calls available see is available see is goes through it says okay using the item type and depot field is this the right class and location for this thing do you have assets that are available in these places for me if you do give me a list of them it's not asking the available yet that's for everything that it finds go and check is it available that's what that's about this available ci says and this is sort of a secret sauce that makes all the conflict checking happen it's this encoded query looks worse than it is it's really two conditions says are you checked out and overdue then you're not available or are you coming up and you overlap the start and end date with my start and end date that's really all it says if any of that if none of that happens then this CI is available there was a lot of picture drawing on this but it's really a fairly simple equation just looking for overlaps I check that put in my script so it checks all CIS available at that location at that date that I've requested I don't know if I hit a conflict or not with my sample that I just put in for Chicago next thing I need to do is go and update the CI field so a couple of ways I could do that but I think my fastest way is going to be to go into the item field look at this I've got an item from London that was checked out using a Sydney asset how does that happen maybe things get swapped around and that they it got left in London I don't know let's go to the item field configure dictionary and this comes from the task table which means all this stuff is going to be read only I'm gonna sculpt down this is one of the benefits of scoped apps you don't accidentally impact other people that are using global assets like this field down here is what we call dictionary overrides these came out around 2010 2011 allowing me to override some of the settings of how this field behaves a for a certain table and I already have a dictionary override as I mentioned before that has a simple reference qualifier that says if that CI is a loner show it to me does it do anything else that's a very smart what I need to do is put in my reference qualifier that calls my new smart function that says a little bit of JavaScript here go to the loner util include pass it the current record that's the request that I'm making and run that CI reference qualifier function that's all it does not too bad save that my dictionary is now updated I am going to go back to my loaner request and note C we're gonna find my request that I got here for this one it's now using a combination of all these factors so when I click this magnifying glass says yes I have Chicago two available because look I want to laptop from Chicago between these dates if I change the depot to Sydney it now says I've got Sydney o1 available for you on this date if I change to London something's checked out something's not I've got both London assets available so it's gotten a lot smarter it avoids conflict with that checking okay I've got just a few minutes left and I still want to do the cool mobile stuff ok very handy so I checked I mentioned in studio that I know when I was going through got an app creator that I checked off that box that says create mobile and it set up some stuff for me I'm going to use some of it but not a lot of it first thing I want to do is go into mobile studio and I've got some assets here already created for me I to create a new applet there is already one called loaner it's got a full list of all the requests it's like the unfiltered list from the classic UI and I've got some loaner tasks but I'm not using that let's create a new one simply called active and that's how I'm going to present it on the mobile app I have my own mobile app already to go over here on my mobile display with the request that's what it looks like right now let's create a new list and I've got some layout features here what do I want to see on that list and how do I want to see it I've got the ability to change patterns certain patterns look better for certain kinds of things whether it's a person to contact a case whatever just for enlightenment sake I'm going to change my pattern to this one over here it's got some coloring that I want to take advantage of it's got a little different layout and I scroll down down down down I've got classic patterns I've got new patterns this is one of our new patterns in Orlando I did that before laying out the fields because when you change patterns that destroys all the fields so let's put in some fields the fields I want our state oh you know what I didn't do I did not put in a data item I didn't say where the data is coming from that's usually the first thing I do I jumped ahead a little bit so let's create a new data item this is just a table and filter condition however you want to do it active loner requests from the loner table and I'm going to you got it active is true very simple filter you can put in other configurations in here once I've defined that then it magically shows up in my data item list and now I get the ability to pick fields if you don't nobody feels you probably don't have a data item let's also put in the number and spell it correctly I'm also going to put in the item and item type and you could see over here on the right it's telling you where it's going to place these things so you get a little visualization of what it's going to look like before it does it also going to put in the actual start date just for fun just to show you something that it gives you some options of how you want that date displayed do you want it displayed as a time or a difference three days or Monday Tuesday Sunday whatever three days from now is and of course I want to know who opened it and I will put that in as well there's my list layout very easily done before I go and look at it I want to do the form layout as well so up here next to list I've got form I can cheat and say give me all the things that are on the parent the the list card as sort of a header for this but I first want to change patterns do that on both of them because you can have two different patterns one for the list and one for the form then I use this icon to replicate I'm going to add a couple more things that's the form overall setting by going to the body I can add even more fields I'm going to add the open by business phone stick with me I know we're getting down to the wire here this is very easy to do a lot of this was done by guided app creator but I am showing you what it would take to build this yourself I'm going to add the description so I have the details remember mobile is not meant to have every field you need it's meant to be a quick in-and-out experience it's it's what do you essentially need kind of like a record producer mentality what do you need to make this go not everything under the Sun every field from every table on every form that's not a mobile experience let's go and refresh this by pulling down I do have this in remote control oh you know what I didn't do I didn't put my applet on the page okay so I go to an applet launcher that was that page I have my loaner applet launcher which is this part up here you can tell from the header that it's the loaner one and I have a section called request and there is my active outlet place it on the page save that go back to my mobile app refresh there's my active list and I have created a mobile experience click on one of these it goes in there's the phone and description now in the interest of time I would like to put a style on here but I'm not going to do it I'll show you maybe another time on how to do mobile field styles it's not that difficult but so you can make the overdue check that one's red like we did on the other list but I am going to pass that by for the moment it's just su to take a little longer than I wanted what I would really like is a way to check this in remember my process and my flow is waiting for it to go into post how does he get there from checked in I'm going to make a function so first I need to create a new action item this is the what I want to do not the trigger not the location but let's call it loner check-in on the this part confused me about making functions at first but when you break it down into its layered components we're building reusable components unlike a UI action where everything is defined in the what it does and when it does it and how it does it all in one page this one is built in a stack so I'm going to set the state to post that part can be reused in a number of places the next piece I need to do is create the actual action so underneath functions I have actions pop that out I've got some again that are already built by guided app creator but for me I want to create a new one call this loner spell it correctly loner check-in and I already know that I created my action item again I can apply that in multiple places this is just one of them so well this feels a little like overhead at first I need to pick a table or when do you want to what was this this was the Oh when do you want this to to actually do something and I want it to be on the loner table this is the kind of the trigger for it when state is checked out this talking instead of typing so when this will be available when that condition is happening now the where where do I want it I want it on my active outlet on the list as a swipe function this is where it gets kind of fun oh so here is my list I've got the data and fields and now I've got functions over here I've got top menu functions which are the three dots they line up and I've got swipe function swipes are kind of fun makes you feel like you're really doing a mobile experience at this point the label does not have to be the same as what I called the function something close would be nice there's actions there's my loner check-in I wanted a left swipe I save it go back to my mobile app and swipe down go to active and here's a checked out item nope somehow I drilled in accidentally I'm doing Mouse and fingers at the same time oh don't don't don't do it okay here's an item that is checked out clearly fred has an item this is really hard with the mouse so I'm just gonna go with the phone and I swipe there's checked in notice that it does not appear I'm swiping on the one above it for Sid 0:01 there is no swipey swipe going on there because it's not in the right state so if I swipe that and click check in it now goes to post I've got a fully functioning function and that does something the other one that I would like to show you what unfortunately ran out of time is how to make the call button on business phone the call button an actual button that's done with a smart button you put it on the field you say it's a phone and it will dial the phone for you so apologies for running out of time on a couple of those very very useful stuff that that's what I would build if I were gonna be doing the loaner request system today we created the data model beforehand but again not a lot of time form field uix this is business logic in flows and you could do some business rules you could also I recommend doing a business rule or some sort of scripting to check the due dates when I was picking start and end dates they could have been reversed that would have been bad that would have messed up some serious logic somewhere what about a chat bot when is my item due back I'll make some conversations around that guided tours to show somebody how I easily fill some of this stuff out so a lot of stuff that was done thank you thank you for joining me that was a full hour of stuff and look forward to seeing you on the next episode of this show to build something else get you tools in your toolbox and I will talk to you again real soon again thank you have a wonderful day wonderful weekend go learn something go share something and be very very helpful talk to you later bye [Music]

View original source

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