Need Help with GlideDialogWindow

SandeepKSingh
Kilo Sage

Any good example of a client script opening a GlideDialog window??

I am preparing for Interview any good Example will be appriceated.

2 ACCEPTED SOLUTIONS

Paul Curwen
Giga Sage

Impress them more by telling them this:

 

This API has been deprecated, use the GlideModalV3 API instead.

 

https://developer.servicenow.com/dev.do#!/reference/api/utah/client/c_GlideDialogWindowAPI

 

The GlideDialogWindow API provides methods for displaying a dialog in the current window and frame.
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.
 
But if you must use it: 
 
 
This will also get you some interview bonus points:
 
At the moment ServiceNow do not provide a single method for Modal Popups across Portal, classic forms and Workspaces. The use of Alert,Confirm and prompt should be avoided. sp_modal does not work anyplace other than Portal, GlideModal does not work on either Portal or WorkSpaces. g_modal works on Workspaces but not classic forms or Portal. Solution, use g_modal for Workspaces.

 
***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

Hi @SandeepKSingh 

Follow the Article :- https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid...

 

// Creates a dialog window
var gdw = new GlideDialogWindow('show_list');

// Creates a read-only dialog window
var gdw = new GlideDialogWindow('show_list', true);

// Creates a dialog window that is 400 pixels wide
var gdw = new GlideDialogWindow('show_list', false, 400);

// Creates a dialog window that is 400 pixels wide and 200 pixels tall
var gdw = new GlideDialogWindow('show_list', false, 400, 200);

Below is the explanation from now_Assist.

The code block demonstrates the creation of dialog windows using the GlideDialogWindow class.

  1. var gdw = new GlideDialogWindow('show_list'); - This line creates a standard dialog window with the identifier 'show_list'.

  2. var gdw = new GlideDialogWindow('show_list', true); - This line creates a read-only dialog window, preventing user modifications.

  3. var gdw = new GlideDialogWindow('show_list', false, 400); - This line creates a dialog window with a width of 400 pixels, allowing user interactions.

  4. var gdw = new GlideDialogWindow('show_list', false, 400, 200); - This line creates a dialog window that is 400 pixels wide and 200 pixels tall, also allowing user interactions.

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

3 REPLIES 3

Paul Curwen
Giga Sage

Impress them more by telling them this:

 

This API has been deprecated, use the GlideModalV3 API instead.

 

https://developer.servicenow.com/dev.do#!/reference/api/utah/client/c_GlideDialogWindowAPI

 

The GlideDialogWindow API provides methods for displaying a dialog in the current window and frame.
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.
 
But if you must use it: 
 
 
This will also get you some interview bonus points:
 
At the moment ServiceNow do not provide a single method for Modal Popups across Portal, classic forms and Workspaces. The use of Alert,Confirm and prompt should be avoided. sp_modal does not work anyplace other than Portal, GlideModal does not work on either Portal or WorkSpaces. g_modal works on Workspaces but not classic forms or Portal. Solution, use g_modal for Workspaces.

 
***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

Ravi Gaurav
Giga Sage
Giga Sage

Hi @SandeepKSingh 

Follow the Article :- https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid...

 

// Creates a dialog window
var gdw = new GlideDialogWindow('show_list');

// Creates a read-only dialog window
var gdw = new GlideDialogWindow('show_list', true);

// Creates a dialog window that is 400 pixels wide
var gdw = new GlideDialogWindow('show_list', false, 400);

// Creates a dialog window that is 400 pixels wide and 200 pixels tall
var gdw = new GlideDialogWindow('show_list', false, 400, 200);

Below is the explanation from now_Assist.

The code block demonstrates the creation of dialog windows using the GlideDialogWindow class.

  1. var gdw = new GlideDialogWindow('show_list'); - This line creates a standard dialog window with the identifier 'show_list'.

  2. var gdw = new GlideDialogWindow('show_list', true); - This line creates a read-only dialog window, preventing user modifications.

  3. var gdw = new GlideDialogWindow('show_list', false, 400); - This line creates a dialog window with a width of 400 pixels, allowing user interactions.

  4. var gdw = new GlideDialogWindow('show_list', false, 400, 200); - This line creates a dialog window that is 400 pixels wide and 200 pixels tall, also allowing user interactions.

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/