GlideForm Introduction

Mark Miller
A free video tutorial from Mark Miller
ServiceNow Guru
4.4 instructor rating • 5 courses • 38,895 students

Lecture description

GlideForm is a client-side API used to manipulate form data. In this section, we'll introduce the API. 

Learn more from the full course

The Complete ServiceNow Developer Course

Learn how to develop on the ServiceNow platform!

08:41:44 of on-demand video • Updated October 2019

  • Develop on and customize for the ServiceNow platform
  • The ServiceNow APIs
  • When & where to script in ServiceNow
English [Auto] Hello and welcome to Section 6 glide form and glide user We're finally halfway through the course and this will be a great section because we'll discuss not one but two client side API is glide form and glide user so this sections outline is as follows I'll provide an introduction to glide form and we'll do a show me the code section. We'll talk about the client side environment and we'll discuss the glide form API diagram. Then we'll take a look at some common glide form methods and do a glide form demo. After that we'll jump back into the slides where we'll do a glide user introduction and show me the code section for glide user. Then we'll cover the glide user api diagram and go over the glide Muser methods and end with a glide user demo and a section recap. So what is the glide form API. Well as stated in the service now Dock's the glad form API provides methods to customize forms the Global Object G underscore form is used to access glide for methods platform methods are only used on the client. These methods are used to make custom changes to the form view of records. So there are three important takeaways from this. One is it's client side so we cannot use this on the server side. Two we use glide form to make changes to the form and the fields on the form and three we reference this API by using the underscore form all right. Now let's take a look at the show me the code slide. So in this example you want to set short description to mandatory when priority changes. It's important to note here that we can accomplish this by using a UI policy but for the purposes of this demo I wanted to use the form set mandatory method instead. So here in the first image we can actually see in the client script. We have a type of on change and the field name is priority so whenever the priority field changes it's going to execute the following code. So on line 5 we have our form API where we're accessing the set minatory method which takes and two arguments the first being the field value. So short description and the second argument being a boolean we want to set this to mandatory so will pass and true. So with one line of code we can see just how easy it is to. In this example make a field mandatory. All right now let's talk a little bit about the client side environment. So client side means running inside of your browser so all of the code is already shipped to your browser in client side scripts. We have access to client side API is where most of these are actually accessible via the global javascript scope with inservice. Now you can press control shift J to open up the client side javascript executer whatever code you type into here will be ran on the client side. This is kind of similar to background scripts where we run server side code. But in this case it's client side code. Finally since we're on the client side within our scripts we can always debug to the browser using something like the browser's cancelled out log method or a consulate. Derb method I would like to point out that it is best practice to avoid manipulating the DOM directly in service now within something like a client script or UI action and it's recommended instead to use the form API. Now let's take a quick look at the glide form API overview. So here we can see we had the glide form API and on the left we have the form and fields properties on the right we have a number of methods such as get value set value add error message at Info message and so on. Within the next few videos will take a deeper look at what these methods actually do.