ServiceNow IDE and Fluent (sdk v2) w/Patrick Wilson and Jay Couture
ServiceNow Dev Program
·
Aug 14, 2024
·
video
[Music] oh [Music] m [Music] well hello and welcome to Creator toolbox this is the show where we take service now developers and admins and show them the great tools to put in their toolbox hence the name Creator toolbox my name is Chuck tasi I'm a senior developer Advocate at service now finished since 2010 customer for a couple of years before that and a long long history let's go into the rest of our intros and then we'll come back to the content real quick go over there Earl hi everyone My Name is Earl duk I am a senior developer advocate here at service now I'm three years into being here at service now but before that I was like four or five years doing development at service now customers mostly in higher ed and then I'll pass it over to Patrick hey everybody my name is Patrick Wilson I'm an engineering director here at service now been here for uh 10 years a little over 10 years now uh worked on a lot of stuff in that time service portal UI Builder ux framework General UI stuff uh super excited to be uh helping to lead our uh Dev tooling initiative here now hey folks I'm Jay cutor I am Patrick's product counterpart over our developer experience in prodev tooling I've been at service now for a little over a year now and we are super thrilled to be here to show you some of the new tooling that is coming out that uh you're going to be using hopefully and um we're excited yes we are excited for this it is part of our xanadoo release logo and pointing there it is you can find this and the rest of our upcoming content as we record this perhaps you're watching this later you'll find everything at our content calendar at Dev link.net simple so we can remember it so you can remember it that's that's the way it goes all right enough of the intros and the housekeeping I'm going to turn it over to Jay you start the you start the tell us what we're doing today thanks truck so we're g to be talking about some of the awesome stuff that's come out as part of xanadoo and is available right now as part of early availability so we launched some really really exciting tooling and we'll be giving a demo today of a few things so first we've got the service now integration development environment or service now IDE we've also got a really big update to the service now software development kit and as part of that SDK we have service now fluent so we'll go into detail on a bunch of these things but a quick plug the service now IDE is available on the service now store for instances that have upgraded to xanado do early availability and if you search the service now ID in the store this will come right up there is no license or cost Associated to it get it and install it right on your instance uh the other thing to quickly note here is the service now SDK this is available on npm or node package manager uh version two of the SDK came out about seven days ago and there are installation instructions here Patrick will go into more depth on the SDK and service now fluent so let's take a look at the service now IDE this is essentially Visual Studio code IDE a very very popular IDE for doing JavaScript development and what we've done is we've taken Visual Studio code and we' put it on a service now instance uh this is my kind of internal testing instance and we see it's running on the service now platform this our service now IDE logo and I'm greeted with this high welcome to the service now ID page Jay can we make that a little bigger the font size a little bigger I can try nice high resolution screen is this any better yes excellent thanks truck great so what I want to go through today is really the getting started experience uh how do I get started with the service now IDE I've just installed it I want to try it out and see what I can do so when I come into the service now IDE the first thing that I want to do is create a work space so I'll click this create a workspace button the alternative thing that I can do here is I can use the vs code hotkey on Mac it's a command shift p to open the command pallet on Windows I believe it's control shift control shift p we have hys so I can type in we do have hot keys I can type in workspace and create a workspace or I can just click this create a workspace button and do the same thing so let's create a brand new work space for us let's call it uh toolbox demo so I've got my toolbox demo workspace let's make our first app as my description so we created this workspace and now I'm in my empty workspace I get some cool tips here on exactly that hotkey and some of the other useful hot keys that come packaged in as part of VSS code on my instance here and I'm given these called to actions so I want to create an application let's do that let's create our first application let's call it toolbox demo so this is our toolbox demo app and let's say we want to make a uh Todo List application let spell things correctly so we will prefix um your application with the required part of the scope here xor snc and then toolbox demo so this will be the scope name for the app that I'm creating and it's going to ask me if for package name this is in case I want to push this to say my internal npm registry or even the public npm registry so that I can reference it as a dependency and we'll get a little bit more into that a bit later so a workspace can contain multiple Scopes and packages is that correct that's correct Chuck it certainly can is there a Best practice about one: one or doesn't matter or put your put your packages with their dependencies any any thoughts or recommendations on that so the recommendation that we have is a onetoone relationship with applications and Scopes and get repositories as a matter of fact so it makes sense to have one application tied to one repo and then all of the applications that I have as their own folder in our workspace here and actually to kind of demonstrate this I'll create another application okay uh we'll just call this application to demo uh demo and once I've got this second application you'll see a second folder pop up with that application it takes a second to actually bootstrap all of the pieces of U my application being installed here in my workspace and we see this application to demo and Chuck one of the really cool things I'm glad you ask this is when I have these two different app Scopes so these folders Here app 2 demo and toolbox demo or separate app Scopes I don't have to use the scope switcher here to switch between them if I open up a file in either of these applications will automatically switch that scope for you and you can start working on stuff in that scope and I can hop back and forth really easily for that nice frictionless experience of collecting all of the applications that I want to work on in the same time in my workspace and getting that work done really quickly so that's super cool yeah awesome so let's talk a little bit about the actual structure of this application so now that I've kind of bootstrapped this toolbox demo application um we see a few folders here this do now folder folders that are prefixed with a DOT are kind of suggested to be hidden meaning that I shouldn't necessarily change anything within them unless I really know what I'm doing here and this just has some information about some of the dependencies and how this gets deployed within my instance we've got this uh what should be a metadata folder will be um that will contain all of the XML files as part of my application and dictionary updates again once I actually build up this application this will populate for me something that I shouldn't really modify because the purpose of the service now IDE is to modify readable code with our brand new programming language our domain specific language called service now fluent um but just to show that this application still has all of the pieces of a classic St application we just added this abstraction layer on top of it to make it easier to write applications in code so we'll come back to that in a little bit I've also got my node modules here um which one of the cool things that I can do is actually take advantage of JavaScript modules within my service now applications and Patrick will go into a lot more detail on this I will sort of touch on it but we'll take another look once I actually build up this application so the main thing that I will want to be interacting with here here is the source folder and this looks similar to the structure of a node.js application so within my source folder I've got a fluent file and a folder and a server folder So within my fluent folder I've got sort of the bare bones of a service Now application and since I'm kind of working on my getting started experience here I'm going to point folks to our documentation this is the xanadoo documentation for the service now fluent domain specific language and the really cool thing about service now fluent is that it is based on typescript it is a declarative subset of typescript and the way that I think about it is it's kind of like strongly typed Json for defining by application metadata as code and I'll explain a little bit more what this means when we actually do it but if I want to get some information about what types of metadata with my within my application that can write in code kind of the magic incantations I can find this here in our documentation so from the service now fluent page um let's copy in kind of this first block of code so what this is going to do here in my application is create a few things it's going to create a client script a business rule and a table so when I copy in this code um I'll just kind of walk through it quickly what we're doing is we're importing from the service now SDK which Patrick is going to give a demo of that but with the service now IDE we've kind of packaged up and run a service that does all of the same functionality as the SDK in a service and when I call out to it with this build button down here which is something that we'll do shortly um I get access to all the functionality within the SDK including the compilation of my fluent code and from the service now SDK I'm importing the business rule API client script API the table API and then a couple of types of columns so that I can actually Define these things in code in my application and we see some red squigglies here telling me hey you don't have this example to-do scope going on so what I have to do is fix this so that it Accords with the scope that I've created so that scope was toolbox demo and then we'll call this too table and I'm going to come down and do the same thing for my client script um toolbox demo to do table and I have to fix it up here as well so that my Scopes Accord with uh the scope in which I'm working so toolbox demo to do table and one more um we just kind of copy and paste here to make things a little bit easier within the business rule that I am defining and the other thing to note here is that I get a little bit of an explanation as part of this kind of sample code that's ready and available for you and for the other types of metadata uh if I come back to our documentation we can see I can Define all kinds of metadata with service now fluence um if I want to click into any of these I can see some um example code that I can use like being able to Define an ATF test as code automated test framework that's really really cool and I see exactly what the parameters that I need to pass are for defining that ATF test so that gives me a little bit of information about how to actually use these things and let's actually build up our application here so now that I've kind of fixed any of the errors that are surfaced to me what I want to do is now that I've kind of written this code I want to see it on my instance and the way that I do that is I click this build button so by running a build with the service now SDK build service what we're doing is we're packaging up this application we're sending it over we're compiling it and translating it to a format that is readable by the instance which notably is XML and we see some output here Jay sorry to cut you off I think you have to save your file real quick excellent I aide thank you Patrick sweet save early save often save early save that's right and I do that with the control s thank you for that note yeah no problem um so as I build this application I get some in some output here from the SDK itself telling me that okay you know we've actually output some of the cool stuff that you wanted to have in your instance within this metadata folder um with the CIS app here and some of the node modules packaged up and I want to actually test and make sure that what I've built here is working so what I can do is I can come over to this extension the metadata Explorer extension and drop down this toolbox demo app and I see some categories of metadata that I've created here and let's say I want to look at that table that I've created this to-do table so let's open this up and let's search for um that table that I created in table Builder here um toolbox toolbox demo to-do table so if we open this up I can actually um change my scope here so that I'm in the right scope the toolbox demo scope let's apply that and I can add a column here um let's call this uh the feedback column new feedback column string column so now that I've added this new column to my table what we do with the service now IDE is we keep an eye on what's happening in your instance and every once in a while the IDE will kind of wake up and say hey I've noticed that some metadata on the instances has changed we want your source code to be the source of Truth for the state of your instance and I didn't write this line this wasn't here before this showed up automatically as I made this change in the form Builder here for my table I created this feedback string column and we've pulled this into my code automatically I didn't have to write this so one of the really cool things here is let's say Patrick is working on the same application and he's doing so in our uh low code declarative tooling like table Builder or from a uh form view as he's making and saving those changes we'll pull them into the source code here so that my source code is always up to date with the state of my instance which is really really cool um some of the other cool stuff that comes as part of the IDE here is our um service now fluent language server so if I'm trying to edit this business business rule I don't have to memorize exactly what the actions are um that apply to a business rule if I open up the quotes here I'm given the options of delete insert and update and I don't have to know this off hand so if I want to add some actions on which this business rule runs I can do that and add a delete and if I type it wrong I fat finger it and I put Deleted I get an error here saying deleted is not assignable to this Ty did you mean delete yes of course I did that back I just want to show something cool too if you add that eror back or create another error like that's good yeah and then if you go down to that errors tab on the bottom left the little far bottom left yep click that so we surface all of your compilation errors and build errors here as well so you have a good kind of high level understanding of the ways that you're app that's broken before you even have to build it oh wow it even suggest is the right word that's right are amazing I can I can quick fix some of that stuff um so let's actually go ahead and add in uh one more parameter here and um you only have one choice it's insert that's right so if I added my insert I get all this correct I save my file I run another build I open up the business rule that I was working on down here in my metadata explorer that shows up in server development under business rules I can open this business rule in the form View and what I actually want to do is I want to split this right so that I can look at the business rule while I'm working on the code side by side opens up right in the platform and we see these new options that I added and of course this works both ways if I uncheck the update and delete and I just want to have this run on insert and I go ahead and save this business rule that same Magic on line 49 here will happen when the IDE notices that the state of my instance has changed I've removed those things from the definition of this business rule it will go ahead and remove this from line 49 here and it runs every so often and we saw that that just happened that stuff has been deleted of my code now my code is the source of Truth which is awesome so the next big question is great I've got this application I've defined it in code I'm happy with it and I want to save it I want to share it with Patrick I want to take advantage of all the really nice functionality for doing collaborative development with Source control and how do I do that so we have the source control panel here the source control extend exension and the way that I can think about this is as if I were working locally on my desktop when I initialize a repo we call this kind of a local get repo it's local to the IDE here and the virtual file system on my instance so when I initialize this repo for the toolbox demo application we'll call the default Branch main as is customary and I'll see all these untrack changes let's go ahead track the these changes that I've made um so now that they're staged let's call it my first commit and we'll make a commit to my repo this to your you said to the in is this to the instance or to your workspace specifically like where where is this initialized what level so Patrick do you know that one yeah so the repo is initialized for the application that you've created so you have your workspace that has a bunch of applications inside of it each one of those applications Maps one to one with it get repo so in this case it's mapped to only one of those apps that Jay created as part of this demo is actually going to get synchronized up in get you could then take that other app that Jay created and push it up to some other repo as well Jay do we have the um communication of who changed what back and forth when I'm looking at this right and left if I'm on an instance and a value of a field changes I get the little you know heartbeat icon and you hover over and it says J changed the value of this field when you weren't looking you're you're making changes on both side if I were to go into the code and change it to update is it going to have the heartbeat and likewise how would I know if somebody changes something I'm trying to figure out Conflict Management with two people doing the same thing on the or different things on the same file yeah Chuck so my recommend go ahead Patrick sorry um sorry to cut you off there um yeah so the um I think I think one thing important kind of detail of how all these things come together is that um for an application like let's say you've got like two different users using the Ide at the same time on the same instance uh and they both have the same scoped application checked out in the IDE so maybe it's you and me you and I are both on the this IDE we have it open in two different Windows two different user accounts as you're making changes to files I'm going to see those files propagate over into my workspace as well because we're synchronizing our file system over the instance so as you change files I'm going to see the change that I've made as I change files I'll see the changes that you've made if you're we're working on the same file at the same time you save something and then I save something we get a little merge window that pops up that prompts us to kind of merge our changes together whoever did the the most recent save it'll tell you kind of like normal vs code like hey the underlying files changed from like you know what you have in in open in the editor right now what do you want to do about it do you want to wipe out the old changes you want to take the new ones do you want to merge them um and every build we and the reason for that is because we only ever run obviously one copy of the metadata at a time uh on the instance we have a solution for that which is a new uh uh platform feature called sandboxes that I'm sure this same audience would be really interested in but assuming you don't have sandboxes that's why we kind of keep or do our best to keep the code that you're working off of and the uh metadata records that you're viewing in the right there as in sync as we can you won't get the heartbeat icon because the heartbeat icon is driven by um uh amb so like a record Watcher that's running on these forms and the form is live updating with the changes and currently changes won't live update in the form it's something that we're working on sure of bringing back uh so you won't see the heartbeat icon you won't have a sense of like who's done what in that way but the source code will always get uh be updated and kept up to date with whatever the metadata is representing on the instance okay but in in if you're working in the code somebody's off changing something on a form it will change live or near near live will you know who's doing that or you just going to say hey your your uh you know your action just changed from insert to insert and update who did that why is it it's the same underlying metadata then you can always go to the application update file you can that's true yeah but we won't inline it in the IDE I think it's an interesting concept like some notion of like who's making what changes it's something that will take back and by the way we love feedback for all of these tools and we really want to understand how the community wants to use these tools the things that folks think it's doing really well the folks thing that uh the things that folks think that it could do better we love to hear about it um maybe a quick plug for reaching out to Jay and myself on LinkedIn or email or wherever else you like to reach people we love feedback we love talking to folks so um you know that's my quick a live G blame a live G blame absolutely and I'll add to that this is tool link by Developers for developers so as Patrick mentioned uh we want to make sure that we're hitting all the use cases that folks are interested in using this tooling for so please don't hesitate to reach out I want to show one more thing before we um actually push my changes to a repo and within this business rule we see that I'm referencing the show State update and that's a script that I'm importing up here from server script script JS and if I come down to my server folder I can see this script.js here that I'm exporting and this is the JavaScript that will run inside of that business rule if I click the Advan button there um and see the script editor I can organize my code better this way by actually writing the JavaScript and exporting it and then importing it into the fluent definition of Say by business rule or uh or client script which is really really cool it's making use of this modular JS concept with Import and Export statements so back to the source control Point let's say I'm happy with my changes I've built them I've checked them out I've saved everything I've staged my changes I've made my commit and now I want to push to a repo I've actually created on public GitHub here this empty repo there's nothing in here we've got this toolbox demo repo and I want to push to that repo so I can either use the command pth it and uh call a get push or I can click the three dots here in the source control extension and push to a repo so the IDE is going to ask me what's the URL of the repo to which you want to push well it's my toolbox demo repo and I'm going to get an error here because I haven't configured my git credentials so of course we can't push it to the repo we haven't given access so let's walk through configuring that quickly here what I have to do is I have to create a g credential let's call it J GitHub Reds and this is going to go to my GitHub account which is Jor and I need to create an off credential here so for that off credential my username is going to be my GitHub username and the password is going to be my personal access token this will work for other git providers as well I'm just using GitHub as an example so folks could use bitbucket or gitlab and their equivalent of a personal access token up we can't see um the uh the cred didn't appear yeah just so the audience it's because window I don't think it's getting shared um we could talk maybe talk over it what you would see is a m like kind of a second window that pops up I mean it's if reference field so everyone's familiar with how that works right in service now and it just prompted Jay to provide a username for his GitHub account and a personal access token that he generated for his GitHub account which you can do through github.com or [Music] bitbucket.org a new one right after and delete this so that my personal access token is not uh recorded we could still use the Privacy shrubbery uh this is for my toolbox demo and I want to give it repo and admin permissions so I'm generating this token already used that name we'll just add some characters there grab my access token and then like Patrick was saying if I click this little search icon uh I get a little window that is not being shared but it just gives me a screen to enter my username and password and again my username is my GitHub account Jor my password is that personal access token and that's how I create that credential so once I've submitted that what is the value of the user field on this form if it's already in your credentials where it says user system administrator right below the auth credential field so this is my service now user so I'm logged in as an administrator on my service now instance if I were logged as J user uh lots of our customers will do this folks will have their own user credits they're not going to necessarily be logging in as admin but it's a great note that the service now IDE does require the admin role because of all of the really powerful features to install kind of whatever you want on the instance so once I created these creds sorry Chu did that answer your question is that to say that only that user can use that credential or just that that credential was created by or or is owned by that user because right now I've got a a GitHub credential as an my personal access token in the credentials table and when I'm in studio for example I could say here's the repo here's the credential I want to use there's no real service now user attached to that credential anybody on the instance who can get into Studio could use that credential and that's the same here so if I wanted to set up um if I just wanted one credential record just for maybe I have like one admin account on GitHub and I just want to use that for my whole team yeah we can create um credential Rec like IDE login records ma to my user to your user to whoever's user but they all resolve to the same underlying credential that's totally okay you can do that or if you want to have different credentials for everybody maybe because you all have your own GitHub accounts um and you want uh you know everything to kind of like display like be associated with the right GitHub user on the other side on the pull request or something you can set it up that way as well I see what that enables okay thank you yeah it's a way for us to basically tie your default credentials to your user so that every time I come to the IDE it knows that I am using buy GitHub credentials so that when I make uh a commit and I push that by default I get to use those credentials so I'm just gonna come over here copy the repo it's why a lot of our both still have ajb as part of the commit name yes because we all it all is the shared in the same credential from way back when so thank you for adding that Nuance so now that I've done a push um from the three dots here and a push to this repo when I refresh we will see the exact representation of this application this is not like just the xmls this is exactly everything that was in my IDE we've got the metadata folder the source folder uh if I come to this fluent folder and look at the index now TS this is exactly that same service now fluent that I was working on in my id8 so now it's in my GitHub repo I can go ahead and create a branch uh you know J demo test one and I can start to make changes to this application on my Branch push up that branch open a poll request and follow sort of the normal uh get workflow that I would and working collaborative collaboratively with a team all at the same time so really enabling the use of kind of standard Source control practices with bring your own source control provider of your choice and having this all work really nicely in the IDE so the last thing that I want to cover here as kind of a transition to Patrick's demo is the use of um third party libraries so so I don't have a command line terminal as of right now in the IDE to do an npm install of something like low Dash or moment so all that I have to do is come into my package Json for my application which has some information about the application itself the name the version the description and if I go ahead and add dependencies here um I want to just add moment which is a common JavaScript utility package for doing datetime calculations and moment2 2301 is the latest version here and if I go ahead and save this package Json um build up my application and of course I would want to like import moment and start to use it in my code I'm actually not going to steal Patrick's Thunder I will let him go deeper into third party libraries here but when I package up this application through the build button what we're actually going to do is go out to npm we're going to grab moment and any of the other thirdparty library dependencies and we're going to install it alongside my application so that I can use it and this will live in the CIS modules table so we see right here we downloaded the type definitions for moment we generated modules and this is available in my application in the node modules folder so I have moment and all of its related code here that I can just grab pieces of import all that nice functionality um this works with low Dash and a lot of other really cool uh JavaScript utility Library so I don't have to write that code myself I can use what's out there uh state-ofthe-art and start to kind of improve the productivity of actually working with JavaScript in my applications so I think that's a good time to end the IDE demo and pass it over to Patrick to go into a demo of the service now software development kit get a little bit deeper into fluent get a little bit deeper into JavaScript modules and third party libraries awesome thanks so much Jay um yeah so um hey everybody so I want to uh show you a little bit of the uh the service now SDK which uh of course we've been looking at for a while now because Jay's entire demo is based on the service now SDK what we've done on our side though is we've taken that build service that uh you know every time Jay clicked that build button what that's actually doing is it's invoking a utility called the now STK in our build system and running a build and uh generating this installable artifact that could be installed on a service out instance and what we've done is we've taken all that build tooling that service now SDK utility that we're running and we publish that to npm so that you can use it on your own development machine too if you've been following this stuff for a little while now you'll know that back in January we also shipped uh the service now SD that was the original release of the service SDK V1 um that uh allowed you to Define modular JavaScript import thirdparty libraries uh we have a great um uh Creator toolbox session that we did uh back then back in I think February or March that you can check out uh but with the version two release we shipped all sorts of new stuff too so um I'm going to show you uh a little bit of the service now SDK we'll see kind of some of the same things things that we saw in the IDE demo we'll just see it through a different lens we'll see it through my local development instead using my own uh local copy of of VSS code and I'll show you some kind of cool new fluent things as well so let's get started by um creating an application so I'm just going to copy paste this because it's a big long command that I want to run to create the exact app that I want to make um so what I'm doing here is I'm using the now SDK which is a utility that I downloaded off of npm um I'm creat creting an app um called xsn C toolbox uh with some other flags that I'm passing in as well here I'm saying I want my app name to be create our toolbox not all of these commands are um required and yes our documentation and the tool itself will explain each one of these commands uh I'm giving it a package name here I'm indicating that I actually want to create a sample table as part of this application as well it's just a nice little way to get bootstrapped with the table right off the bat and here this is actually optional I'm just passing it in to indicate that uh this project type that I want to create is a fluent project which is new to the 2.0 release and we'll do fluent projects in 2.0 by default um so I'll hit enter uh now what we're doing is we're bootstrapping new application it's logging into an instance that I authenticated into through the now SDK off screen um I'll show you what that looks like in just a moment as well we're bootstrapping the app here we're just doing all the same stuff that the IDE actually does when you're uh when you create a new app through that we're just doing it locally in my own command line environment here so uh we're building the app we're deploying the app into the instance that I've logged into the deployment was successful and it gives me a nice little link that I can go navigate to to see my shiny new app so let's go check that out let's log in real quick here I'm just authenticated into a um a uh an instance running xanadoo oops here we go now let's take a look at that new application that we created and here we go so this is the new app I created Creator toolbox app down here I can see all the application files and everything that were created as part of my new app uh right here you can see that we've created a table as well called toolbox too um but let's go check out the source code for that app that got created so if I type LS here I'll clear everything out and type LS we can see that I've created a bunch of files but of course I don't want to edit it um through the terminal maybe not of course maybe there's some emac or Vim heads out there but in my case I'd actually really like to use vs code so I'll do that um here we go I would love to know the overlap of emac people and service now developers there's someone I know there there's got someone out there is stoked that they can finally do emac development ver um and I guess if anyone wants an emx plugin for service now let me know I'd love to hear maybe there is huge latent demand for it but um here we go so I've created my app and now I can see all the it's really all it's the exact same application structure which is really great right so this is all of the same stuff that we saw in the IDE in fact if I went to GitHub maybe I went to the repository that um that that Jay created cre with his application and if I wanted to clone that repo down into my local environment and just run local builds from here that would totally work because it's all the same it's the same stuff it's the same fluent code same package Jason files we just have two different ways that we can edit them which is really awesome um so from here um let's uh let's dig into some things so we've we've seen some of this before right we have this package.json file this is where I'm defining things like the dependencies of my application I have some handy little Scripts set up for myself so I can really easily do builds and deploys and everything with npm uh script executions and instead of this Source folder up here this is where I've got my fluent code now one really cool thing that I want to call out and I'm calling it out because if you are intending to do fluent development on your local machine you will definitely want to make sure that you snag the uh service now fluent extension from the vs code Marketplace it's a brand new extension that we've created to make it a little bit easier to edit these fluent files I'll show you how to get it from vs code if you go over here to this extensions window um here I see all the different extensions that I run myself I've got all sorts of cool stuff in here um and all the way at the bottom I think here we go we have the service now fluent L language extension uh someone here could be the first one to give us a five star I'm not but a bag wait a b are you refreshing this every five minutes um and and and through this extension I mean already we can see that you know if you don't download this extension these files will be treated as regular typescript files um because of course these are typescript files these fluent files are uh uh suffix withn now.t um that's because as Jay mentioned our um our fluent language is a subset of the typescript language uh but it's a special subset hence the now. Ts that we add to the beginning and if you download the uh vs code extension for service now fluent uh which we include by default of course with the IDE but that you'll have to install yourself on vs code then you get this great little service Now icon that indicates that now this is not being treated as a typescript file uh it is now being treated as a fluent file and the reason that's powerful is because I can do things like this like if this were just a regular typescript file we would get pretty cool things like uh type safety so as I'm typing into my um entity here we get this red squiggly that's going to tell me hey um you know it's going to surface a typescript error that says hey that Fu property is not a part of client script uh that's not one of the valid arguments that's a typescript error right typescript errors are really powerful they tell us a lot about the validity of the code that we're building of course fluent does a little bit more and Jay already kind of got to this but one of the really cool benefits that you get if you download the vs code extension is that we'll do a additional U safety checks correctness checks that um you don't get just through typescript so for example uh table names for a scoped application they have to be prefixed with your scope with with your scope prefix um and if you don't then we get all these errors I actually get a few errors in this case one of them is that my table definition needs to be exported as a named export with the name toolbox to do so that's one change that I can make right there to get rid of some of these errors then I'll get more errors like hey name property for this table it has to start with a certain scope prefix that's not a typescript error that's a fluent error and this is happening because we're running the nsdk as part of this extension and validating the work that we doing so every time that you make a change we're passing that into the ndk and that's going to tell us and tell vs code uh whether or not something's broken so I'll undo these changes again and I'll get back into a good State and here we go so now I've got my uh index. now.t file it's got a lot of really cool stuff in it and of course if I open a terminal um I can uh build and deploy any changes that I'm making so uh just as one example let's set let's open up this table real quick in the instance so I'll go over here I'll navigate to my table I'll create a new to-do I'll mark it is ready hello world um here we go so now I've got a nice little toolbox to do if I open this record we'll see that we run a client script here table loaded successfully we can see where that client script's coming from it's coming from right here I've got this client script let's make a change to this real quick just to kind of prove that this end to- end flow actually works so um right here in this client script we have um this cool little script tag that's indicating hey I want to write some inline JavaScript here and I can say um you know hello Creator toolbox save that I'll do now SDK build and now SDK deploy build is of course going to build all of my changes locally deploy is going to push it onto the instance I've authenticated into so let's run that real quick I will take a question from Chuck is it more appropriate to say fluence a superet of typescript rather than a subset since it adds adds features it's actually technically a subset of typescript and the reason for that is because not everything that is valid typescript is valid fluent so fluent is a um it's a declarative language for defining metadata so what that means is that it's not an open-ended programming language so what I can't do is for VAR I equals z i is less than 10 i++ i++ um you know do something okay yeah like if I tried to do something like this I'm going to get an error here in just a second I there we go uh four statements not allowed and that's a fluent error so we do restrict the typescript features that you can use um and the the additional functionality to fluent ads is in the form of these uh these uh entity definitions like client script and business rule things like that so technically it's the subset but I did want to call this out cool so um here we go my deployment is completed let's come back over to my uh form here if I refresh this form hello Creator toolbox so I can edit client scripts I can edit UI actions all sorts of other really cool things so um do I have time for showing just one more thing another quick question you've got you got the business rule script imported and you do the similar thing and where would it go for the client script because you got client script is in line right so for client scripts right now uh um you can in you could inline the script down here in the business rule as well if you wanted to for client scripts I believe there is a restriction currently where you'll have to inline the client scripts in this way um it is something that we're working on we'd like to support module import declarations for client scripts the same way that we do for serverid script there's some limitations that we have and actually enabling that right now and still getting a really clean output on the instance so folks can give AG go I think it might actually work you might get something really weird on the on the instance but I think it'll actually work but in the case of client scripts we recommend uh this this script template tag here and if and when that comes would I see that representing the Explorer like at the same level of server there might be a client um potentially um this the the interesting thing about this server folder is that it's actually uh you can name this whatever you want and uh configure it through I believe it's your package.json file or maybe it's now config uh or maybe I think it might just be defaulted to server actually so you can you can if I wanted to name This Server folder Chuck's server folder that would totally work okay so it's totally convention and that's the thing about most of these folder names the only non-convention folder is this generated folder so nowk if you uh create new records for example on the instance and synchronize them back to your file system it'll dump them by default into this generated folder got um everything else so you can call the the directories whatever you want so let's do one last really cool thing so I want to show just one more kind of EX Advanced um example of uh fluent and something I'm really excited about which is fluent support for scripted rest apis so um to show that I'm just going to create a new fluent folder because we don't have to dump everything in index. now.t and I'll call it my api. now.t so creating another fluent file you can create as many of these fluent files as you want you can put whatever you want inside of them give them whatever names you want and I'm going to copy paste um some uh fluent code from another window that I have that defines a rest API for me and this is referencing a uh file that I haven't created over here yet so I'll also create a uh um a myr api.js file inside This Server here my rest api.js I'll paste in some code into there and maybe I'll even open it side by side here there we go perfect okay so now what I've done here is I've used fluent to define a new rest API for me and I am referencing this process function that I'm importing from this other regular Javascript file over here that's just going to set the body of a message to hello world and we're going to see that working here so um got my rest API let's let's run my build and deploy and actually see it on the instance real quick what I love about this is that we're kind of getting at the ability to do sort of full stack application development with fluent um which is really fun uh creating your tables your rest apis your ACLS everything else you can do it all from fluent so now that that's built I'll come over here back to my instance um I will go to Dollar rest api. Doo our rest API Explorer um and here I will be able to see if I scroll down my toolbox app my little custom API and if I hit my API there we go we can see that I'm logging my message back here so one really common piece of feedback that we got when we ship the V1 version of the SDK was well look this is really great that I can Define modular JavaScript that's cool it's a little frustrating though that I have to keep going back to the instance to use any of these modules that I'm defining like if I want to make a business rule or script addressed API or scripted ACL or whatever and I want to reference those um those JavaScript modules that I'm defining locally in vs code I got to flip back and forth from my instance back to vs code back to the instance back to VSS code it's kind of this weird hybrid development model um folks wanted a solution to that fluence the solution to that so now you don't have to leave vs code for many things you'll still have to leave vs code for some things workflows are a really probably popular example of one that's not supported and fluent yet you'll still still need to edit those on the instance if they are part of your app that you're editing here but for many things you don't even have to leave vs code you can just Define all of this stuff in code and um reference your modules and yeah you when I build apps now much of the time I don't even have to leave my editor which is really awesome for me um and that's it that's the demo uh one thing that uh I don't think I have too much time to show but that I'll just call out is that the same way that the now SDK version one supported third-party libraries we support third party libraries here too of course if you want to know more about that you can check out the SDK V1 Creator toolbox that I did um six months ago or so maybe we can post the link to that uh on this video or I'll post a comment um with that put in the description perfect um and uh all of that carries over of course here it's not new uh we're just continuing to support it and the really new and exciting stuff is all this fluent stuff and um that's the demo do you guys have any questions for me yeah I do have I do have one question uh can you tell us what are upcoming like metad data types that are coming that will be supported by fluent in the future that's not already there yes I will I will take the uh the Safe Harbor question and talk about some of the stuff that is not there yet that we uh are hoping to get there shortly so in terms of metadata types uh we're looking to add what we call fluent plugins or apis for use with the service now fluent language for uh for service catalog and service portal those are kind of next on our list um of course metadata types for flows and um and uib are very important as well those are maybe a little bit further out but certainly things that we want to add to the list of things that you can Define influent and along those lines I want to be transparent as well about some of the other uh I'll call them present limitations for the SDK and IDE uh meaning things that don't work right now but we're working on enabling number one uh folks will notice that the service now IDE does not work in personal developer instances or pdis as of right now the reason for this is because we are running that now SDK build service in the cloud and that doesn't work with pdis today this is something that we're working on um to enable the IDE to work in pdis it's very important to us so that folks can experiment with the IDE and get familiar with it but want to call out that that something that does not work today that's noted on the store Page um couple of other big things as of right now the IDE is for net new scoped applications um the SDK in its present form sort of works with converting your existing scoped applications to fluent you can certainly play with that give us feedback that's something that we're working on Fuller support for uh which will come in the not super distant future for the IDE being able to take your existing scoped applications on your instance converting them to fluent applications and being able to work on them in the IDE um and then the two things that are kind of maybe a touch further out not coming you know in the very near future but the uh certainly foreseeable future are the ability to work on objects from Global scope and Global scop applications as well as app customizations for my kind of out ofth boox applications as we call them so in both the SDK and I those are things that do not work today but that we are working on they are very important to us so again Safe harbor around all of that that's stuff that's not here today but I want to give folks a very clear picture of what works what doesn't what we're working on and I will again reiterate that Patrick and I are here we available reach out to us um our email on LinkedIn YouTube comments Reddit whatever for you want we're keeping an eye on it smoke signal we'll find you we'll find you we want this feedback uh synchronized swimming maybe whatever it takes we will uh we'll collect that feedback we're really interested in ensuring that we're enabling all of the use oh the other last thing to mention in terms of compatibility is um SSO authentication via ooth 2 that's something that we're also working on today it's for basic creds with the SDK um and SSO for SSO into your or using an SSO uh provider with an identity provider for your git accounts that's something that we're working on as well that doesn't work today coming quite soon so I think those are the big things I wanted to mention I think it's very important that folks know um what doesn't doesn't work it's a good road map also um for everybody watching our typical audience for these shows like we're all a lot of our audiences service now admins developers art uh analysts admin like a bunch of people that have no idea what they're looking at when they watched this video for this first time similar to last time we did the SDK and that's okay I think this is a great great time for people to get started learning these traditional developer like processes especially because with service now fluent it's a lot safer to do it like you saw some of the the red squigglies that were happening it it's very safe to start playing around and know that like oh what I'm doing is not going to work or I'm being presented with the right things to do so it's a lot safer especially with um Patrick showed the the example table I think that's the parameter was it example table or demo table sample table Yeah sample sample table with sample table it's going to bootstrap and architect some of those tables for you put some nice scaffolding for you to play with and see how it's actually working so it's there's just a lot of things that they're including that is making it easy for people that have never seen any of this stuff before get really into learning how this stuff works especially because I I love working straight through my own editor it's just so much it's just nicer he's I mean Patrick scrolled through his plugins list it's like there's so many things that make it much easier for you to work with uh in your own editor um and then I I'll plug to that come October we we're going to do hacktober Fest again and a lot of our stuff we're going to try to shift over to utilizing some of our newer SDK stuff and so a lot of that hey we're going to walk you through building your apps through just your editor without ever touching service now but still affecting our production instances so that you can contribute to any of our Integrations that we have with some of our community Works spaces and stuff like that so tune in for that but now's a great time to get started I could just bounce off of one thing you said there just because it really resonates with me so um I I truly believe that I I think that anyone can code I think that you know I'm really excited one of the things that I'm most excited about just professionally is making coding more accessible to more people that's why we did the now IDE and the now SDK we wanted something that was like useful for like the professional developers who don't need handholding and like or don't you know have all their own opinions that they already have about how development should work and we wanted to give them a tool that they could plug into their existing workflows and their existing editors we definitely wanted to do that the reason we built the service IDE is to bring this to more people um you know a really on Rails um like easy simple accessible way to get into coding and I think what you'll see over time is it will bring more power like powerful features to power users and will make the service now IDE simpler than ever and even easier for folks to jump into it and get started um coding I think has a reputation as being this hard you know like magical thing like Wizards casting incantations and it totally doesn't have to be that way like you know it should be accessible it should be fun it should be for everyone and that's what the IDE is going to be for and I'm really excited about that that's a perect clip for us to share on social media to get people to this episode so that's great thanks Patrick okay thanks J thanks Patrick thanks Earl we are at the top of the hour and uh I I learned a lot today I don't know about the rest of you but this was good stuff awesome thanks Chuck thanks Earl this is a lot ofun thanks everyone love being on the box we'll see you again next time everybody take CareOne bye everyone [Music] all [Music] oh [Music]
https://www.youtube.com/watch?v=PHFZBsbTTtI