GlideDialogWindow: Popup Record List

I’ve been meaning to write about the different kinds of Glide popups available in Service-now for a while but haven’t really figured out a good way to show all of the different pieces that make them work. Instead of putting all of the information in one article I’ve decided to publish 2 or 3 different articles showing some of the different things I’ve done in the past. Look for more articles on Glide popup windows in the future. If you want to see all of the articles I’ve written about GlideDialogWindow and popups in Service-now just use the tags at the bottom of this article.
This article shows how you can pop open a list of records in Service-now using a couple of different methods. It also shows you how you could use a UI Macro icon to invoke either of these popup types.

The following scripts can be called anywhere where you can use client-side JavaScript. Most often these would probably be called from a UI Action with the ‘Client’ checkbox checked.

This first example shows how to pop open a list of major incidents in a GlideDialog window.

//Show Major Incidents in a GlideDialog popup window
function showMajorIncidents() {
//Initialize the GlideDialog window
var w = new GlideDialogWindow('show_list');
w.setTitle('Major Incidents');
w.setPreference('table', 'incident_list');
w.setPreference('sysparm_view', 'default');
//Set the query for the list
var num = g_form.getValue('number');
var query = 'active=true^priority=1^number!=' + num;
w.setPreference('sysparm_query', query);
//Open the popup

You can also size any ‘GlideDialogWindow’ object by using the ‘setSize(WIDTH,HEIGHT)’, ‘setWidth(WIDTH)’, and ‘setHeight(HEIGHT)’ methods. For example, to set the width of the dialog above to 600 pixels, I could add ‘w.setWidth(600);’ at any point before rendering the dialog.

In some cases it may be necessary to open the popup in a separate window completely. This script opens a regular popup window containing a list of major incidents.

//Show Major Incidents in a Popup Window
function showMajorIncidents() {
//Construct a URL for our popup window
var num = g_form.getValue('number');
var tableName = 'incident';
var url = tableName + '';
url += 'sysparm_query=active=true^priority=1^number!=' + num;
//Open the popup
var w = getTopWindow();
w.popupOpenFocus(url, 'related_list', 950, 700, '', false, false);

You can also use these functions in UI Macros. Here’s an example that pops open a window displaying high-priority incidents currently open for the selected CI. The script would need to be put in a UI Macro and that macro would need to be added to the ‘cmdb_ci’ field.

UI Macros are associated to reference fields by using the ‘ref_contributions’ attribute on the dictionary entry for that reference field. So if I named this UI Macro ‘show_ci_incidents’ then I could add the macro to the reference field by adding ‘ref_contributions=show_ci_incidents’ as a dictionary attribute for the field. If I have more than one macro I need to add to a reference field I can add them by separating them with a semicolon like this… ‘ref_contributions=show_ci_incidents;macro_2;macro_3’
CLICK HERE if you need to see how to add a macro to a non-reference field.
<!--?xml version="1.0" encoding="utf-8" ?-->


function showCIIncidents(reference) {
   //Get the name of the field referenced by this macro
   var s = reference.split('.');
   var referenceField = s[1];
   //Get the value of the reference field
   var v = g_form.getValue(referenceField);

   //Initialize the dialog window
   var w = new GlideDialogWindow('show_list');
   w.setTitle('Major Incidents');
   w.setPreference('table', 'incident_list');
   w.setPreference('sysparm_view', 'default');

   //Set the query for the list
   var num = g_form.getValue('number');
   var query = 'active=true^priority=1^number!=' + num + '^' + referenceField + '=' + v;
   w.setPreference('sysparm_query', query);
   //Open the popup

Date Posted:

September 13, 2010

Share This:


  1. Scott Brickell October 1, 2010 at 8:43 am

    Hey Mark,

    I was trying the “GlideDialog popup window” for returning a list as you did above. I’ve got it working with the exception that I don’t have the ui action drop down menu and the check boxes for each record. Here is what I’ve got:

    var dialog = new GlideDialogWindow('show_list');
    dialog.setTitle('Crisis Events');
    dialog.setPreference('table', 'u_crisis_list');
    dialog.setPreference('sysparm_view', 'default');
    var query = 'u_active=true'
    dialog.setPreference('sysparm_query', query);

    Any suggestions?

    • Mark Stanger October 1, 2010 at 8:52 am

      Hey Scott,

      Give it a try on /demo and see if you get different results. My guess is that you’re not using ListV2 but I’m not sure. Those elements aren’t anything that can be configured as part of the popup so it’s probably a larger system setting.

  2. Scott Brickell October 4, 2010 at 1:15 am

    We do not have the ListV2 plugin installed, so I am sure that is what the issue is.

    Thank you Mark

  3. Lofty May 23, 2012 at 4:57 pm

    I am using the Glide Dialog popup window to display tasks associated with the selected business service, but since Aspen release a little issue developed. When placing my mouse on the hoverover icon against the record in the Glide Dialog Popup window, the preview appears below the Glide Popup Window making it unusable. Is there a quick fix for this?

    • Mark Stanger May 23, 2012 at 8:34 pm

      Hmm, that seems strange. You really shouldn’t be able to hover over items in a glide dialog window at all. As far as I know, dialogs within dialogs aren’t supported. I think you should contact support on this one. Just don’t mention SNGuru or they’ll try to tell you it isn’t supported. :)

      • Lofty May 23, 2012 at 11:31 pm

        The strange thing is this used to work just fine, ultimately it is just a list of records displayed in a dialog. Without the hoverover preview, it makes the functionality almost useless and I might as well remove it. I will log a call with support, but surely there has to be a way to tell which window appears at the top.

  4. Jonathan Bledsoe September 17, 2012 at 3:51 pm

    I am having trouble with a popup for the user’s recent incidents. I want to display the last five incidents where the user is the caller. Everything works fine except that orderByDesc() does not seem to work in UI Macros and the same seems to be true for getRowCount(). This makes it very difficult to get only the last five incidents. I am having to run a GlideRecord Query before sending the query to the page so that I can find the 5th most recent date and include that in the query. Let me know if anyone has any ideas.

    function showCIIncidents(reference) {
    var call = g_form.getValue(‘caller_id’);
    var date=”;
    var gr = new GlideRecord(‘incident’);

    //Initialize the GlideDialog window
    var query = ‘caller_id=’+ call+’^sys_created_on>’+date;
    var w = new GlideDialogWindow(‘show_list’);
    w.setTitle(‘Major Incidents’+date+’ ‘+query);
    w.setPreference(‘table’, ‘incident_list’);
    w.setPreference(‘sysparm_view’, ‘default’);
    //Set the query for the list
    var num = g_form.getValue(‘number’);

    w.setPreference(‘sysparm_query’, query);
    //Open the popup

    • Mark Stanger September 17, 2012 at 7:38 pm

      I think the problem is that ‘setLimit’ and ‘getRowCount’ are only available server-side. You should be able to accomplish this, but you’ll need to use a GlideAjax call to do it.

  5. harsh October 2, 2012 at 11:50 pm

    In the first exmaple can we set the size of the pop up window.

    • Mark Stanger October 3, 2012 at 6:12 am

      You can. I’ve added a note to the article above explaining how.

      • Jonathan Bledsoe October 4, 2012 at 2:49 pm


        The setSize(WIDTH,HEIGHT) works great in IE however I am unable to get it to work in any other browser. Is there another method we can use to set the size that will work across multiple browsers.


        • Mark Stanger October 4, 2012 at 9:28 pm

          I just tested it without issue when I responded to your post yesterday. If you’re having an issue with the API you’ll need to contact ServiceNow. I don’t know any other way than what I’ve posted.

          • Carleen March 6, 2013 at 3:04 pm

            Hi Mark, I know this post is a little old, but it appears that if you have a long string of text the GlideDialogWindow does not wrap the text despite using the setWidth method. The glide_confirm, glide_confirm_basic, etc all specifically have a nowrap tag in the cell that displays the text.

            We got around this by adding some table html code () to the beginning of our title preference:

            var dialog = new GlideDialogWindow('glide_confirm_basic', false);
            dialog.setTitle("The A-Team");
            dialog.setPreference('title', "</td></tr><tr><td>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn't commit. These men promptly escaped from a maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune. If you have a problem and no one else can help, and if you can find them, maybe you can hire the A-team.");

            Hopefully this helps some additional people running into the width setting issue!

          • Mark Stanger March 6, 2013 at 6:37 pm

            Thanks Carleen!

  6. Mahira March 21, 2013 at 7:17 am

    Hi Mark,

    The list that comes up donot have the usual list properties like sorting and export to Excel,pdf etc. Is it possible to enable these properties for this list?


    • Mark Stanger March 21, 2013 at 8:59 am

      I’m not aware of any way to do that.

  7. Monroe May 29, 2013 at 6:42 am

    Hi Mark,
    Is there a way to make an update to multiple records from the popup list that’s on a different table?
    I created an UI Action that’s only a list choice (titled, “Add Asset to Requested Item). When I popup my list (of assets) I want to be able to add any selected assets in that popup to the parent requested item. I’m having trouble doing this because I am unable to reference the sysID of the form/sc_req_item in my UI action.

    • Mark Stanger May 29, 2013 at 7:51 am

      There’s no way with a standard popup list that I’m aware of.

  8. Robert jokim August 28, 2013 at 6:01 pm

    I want a dialog popup from a UI action (or macro) showing a list of records. No drama so far.

    However, when I click a record from the table, I want this to populate a certain field (a reference field on the incident form) much like it would when opening the dialog from the magnifying glass icon. I can’t figure out this part! Any help would be greatly appreciated.

    • MG January 23, 2017 at 2:50 pm

      I’m looking for this functionality too.

  9. Divya April 18, 2017 at 12:05 am

    Hi Mark ,

    When we open the dialog box is it possible to set a dynamic filter so that we can see what we want.

    For ex i have this “Show Active Incidents” on the Requested for field in Incident,so when i click on this I will get all my Active incidents but is it possible that i can see others incidents too just by having a filter like we have a normal LIST.


    • Mark Stanger April 18, 2017 at 6:01 am

      I don’t know of a simple way to do that with these methods currently.

  10. Alessandro May 11, 2017 at 1:18 pm

    Hi Mark,

    I’m trying to use this feature to show a popup with HR Profile but it always assume the last view used in the HR Profile form even though I’m forcing the use of another view. Do you have any idea on how to resolve this?

    • Mark Stanger May 11, 2017 at 1:37 pm

      If you’re forcing the view with a parameter as shown above and it’s not working then you’ve probably found a bug or some other configuration issue/conflict in your instance. You’ll probably want to talk to SN support to investigate.

Comments are closed.




Fresh Content
Direct to Your Inbox

Just add your email and hit subscribe to stay informed.