- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 05:18 AM
I have synced azure ad to servicenow. Now i need to get the list of users present in servicenow. How can this be done using client script?
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 01:01 PM
yes in servicenow when you create a variable there are different variable types. One is a String type which you are probably using. You can create a reference type and that should do what you are explaining above ^.
This is what it will look like on the form
if they enter a name that is not in the user table this happens...
I believe this is what you are looking for. No need to customize this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 05:38 AM
not sure what exactly you are asking but if you want a query of all user in javascript you use:
var users = new GlideRecord('sys_user');
users.query();
while(users.next()){
//this will iterate through all the users
//insert code here
}
or you can just go to the users tab in the left pane and look at the all the users there. you can export the whole user list into an excel file too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2022 12:29 PM
I am new to javascript. But what I am trying to accomplish is the following. I need create a function so that the query will print all users with gender =male.
var rec = new GlideRecord ('sys_user');
if rec.gender = "male" gs.print('user name'+rec.name);
rec.query();
while 9rec.next() ) {
gs.print('user name' + rec.name);
does this make sense?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 06:06 AM
Hey Naman,
Use GLIDEAJAX in client script for retrieving users.
From Glideajax you can perform server side operations.
Refer this -
Examples of asynchronous GlideAjax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 11:41 AM
The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: AJAX
Visit http://docs.servicenow.com for the latest product documentation