The CreatorCon Call for Content is officially open! Get started here.

GlideDialogWindow : Help to open in a new window

gautamchawak
Kilo Explorer

I have written a code to open a UI page using GlideDialogWindow. The page is opening in the same frame but I want it to open in a different window (like the results given by popupOpenStandard(url)) with scrollbars. Here is the code that I have written:
//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow("service_rerouting"); //Render the dialog containing the UI Page 'task_comments_dialog'
dialog.setTitle("Rerouting Options"); //Set the dialog title
dialog.setPreference("u_cmdb_ci", u_cmdb_ci);

//dialog.setPreference('sysparm_view', 'default');
//dialog.setPreference('sysparm_view', 'new');

dialog.setSize(1000,1000); //Set the dialog size
dialog.render(); //Open the dialog

Is there a way, I can change the target for opening the window.

6 REPLIES 6

Glad you got it working. Would you mind sharing the details of your script/solution?


Sure. Please find below code on the client side and on the UI popup page.

Below is the client side UI macro code on which modal dialog is opened:
var param = g_form.getValue("formvar4");
var url = 'someurl.do?sysparm_param=' + param;
var w = getTopWindow();
var retval = w.showModalDialog(url, window.self, 'dialogWidth:950px;dialogHeight:750px');

if (retval) {
var objArr = retval.split('|');

g_form.setValue("formvar1", objArr[0]);
g_form.setValue("formvar2", objArr[1]);
g_form.setValue("formvar3", objArr[2]);

gsftSubmit(gel('sysverb_update_and_stay'));
}

Below javascript code return values from modal dialog window back to the original form :

var returnStr = formvar1_val + '|' + formvar2_val + '|' + formvar3_val;
window.returnValue = returnStr;
window.close();