Please use docs.servicenow.com for the latest documentation.
This site is for reference purposes only and may not be accurate for the latest ServiceNow version
GlideDialogWindow API Reference
This article applies to Fuji. For more current information, see GlideDialog Window at https://developer.servicenow.com
The ServiceNow Wiki is no longer being updated. Please refer to the Developer Portal for the latest information.
{{Topic|Scripting Glide and Jelly
Overview
This page describes methods for displaying a dialog in the current window and frame. For information on how to use GlideDialogWindow, including use cases, see Displaying a Custom Dialog.
Where To Use
Use these methods in scripts anywhere that you can use a client-side JavaScript. These methods are most often called from a UI Action with the "Client" check box selected.
Method Summary
Return Type | Method |
---|---|
void | destroy()
|
void | setTitle(String title)
|
void | setSize(int w, int h)
|
void | setPreference(String name, String value)
|
void | render()
|
Constructor
GlideDialogWindow(String id)
Constructor to create a new dialog window object.
Parameters:
- id {{#if:String|- (String) the name of the UI page to load into the dialog window.}}
Example:
<source lang="javascript">
var gdw = new GlideDialogWindow('show_list'); </source> |
Method Detail
destroy()
Closes the dialog window.
Parameters:
- None {{#if:|- ({{{2}}}) {{{3}}}}}
Returns:
- void {{#if:|- {{{2}}}}}
Example:
<source lang="javascript">
//Destroy the current dialog window. GlideDialogWindow.get().destroy(); </source> |
setTitle(String title)
Sets the title of the dialog window.
Parameters:
- title {{#if:String|- (String) the title for the current window.}}
Returns:
- void {{#if:|- {{{2}}}}}
Example:
<source lang="javascript">
var gdw = new GlideDialogWindow('show_list'); gdw.setTitle('test'); </source> |
setSize(int w, int h)
Sets the size of the dialog window. If you do not pass width and height parameters, a default size is used.
Parameters:
- w {{#if:int|- (int) the width of the dialog window.}}
- h {{#if:int|- (int) the height of the dialog window.}}
- void {{#if:|- {{{2}}}}}
Example:
<source lang="javascript">
var gdw = new GlideDialogWindow('show_list'); gdw.setSize(750,300); </source> |
setPreference(String name, String value)
Sets a given window property to a specified value. Any window property can be set using this method.
Parameters:
- name {{#if:String|- (String) the window property to set.}}
- value {{#if:String|- (String) the value for the window property.}}
Returns:
- void {{#if:|- {{{2}}}}}
Example:
<source lang="javascript">
var gdw = new GlideDialogWindow('show_list'); gdw.setTitle('Test'); gdw.setSize(750,300); gdw.setPreference('table', 'u_test_list'); gdw.setPreference('title', 'A New Title'); </source> |
render()
Renders the dialog window.
Parameters:
- None {{#if:|- ({{{2}}}) {{{3}}}}}
Returns:
- void {{#if:|- {{{2}}}}}
Example:
<source lang="javascript">
var gdw = new GlideDialogWindow('show_list'); gdw.setTitle('Test'); gdw.setSize(750,300); gdw.setPreference('table', 'u_test_list'); gdw.setPreference('title', 'A New Title'); gdw.render(); </source> |