logo

NJP

Learn MORE JavaScript on the ServiceNow Platform: Lesson 14 Exercise - GlideQuery

Import · Dec 12, 2023 · video

It’s the last one! The last exercise of this entire series. I hope you made it this far
and you're excited to try GlideQuery. I have a pretty straightforward
one for you with one little kind of gotcha that you might have not seen in
the lesson, but go ahead and try this out. Utilize Gride... utilize GlideQuery to retrieve
all incidents with no assignment group
and log their numbers. I have a few hints in there. If you get stuck, try
not to read the hints right away because I want to see
if you can kind of reason out why certain things work certain ways
when you write this GlideQuery. The last break in this series where I play
random music that I find, I'll see you on the flip side and we're back. Okay, So did you all get the same thing
that I did? We started off with a new GlideQuery
for an incident where assignment group is null
because if you put just like this
where we're used to in other places in ServiceNow,
you'll actually get a lot of errors. And so null is the clear
and definitive way to say we're expecting empty here. It's very helpful in JavaScript
to be explicit. And so saying null here
is actually very much more readable for people looking through your script. Did you notice that we didn't need
assignment group inside of our selection
because we're not. The instructions were to not see the assignment group name
is just so return the number. And so we're going to say select number. And then for each incident that we find, print this statement saying this
this number has no assignment group. So go ahead and copy and paste that and go to ServiceNow, let's run that script. And there you go. I know for a fact that there's 34 incidents inside my instance
that have no assignment group. If I do a quick search, you'll see that there's 34 lines here
that say No assignment group. It worked. Yay! The next video is a conclusion video
and talking about resources and advertising our next series of videos
that will appear on a new playlist. So go to the last video and check it out. Good job. Thank you for being with
me for these exercises. Bye.

View original source

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