Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to close GlideDialogWindow

niuweili
Kilo Explorer

Cannot close the dialog created by the UI action.
ui action onClick:

function onClick() {
    var sysId = g_form.getUniqueValue();

    console.log("=== Notification Dialog Initialization ===");
    console.log("Incident sys_id: " + sysId);

    if (g_form.isNewRecord()) {
        alert("Please save the incident record before sending notifications.");
        return false;
    }

    if (!sysId || sysId == '-1' || sysId.length != 32) {
        alert("Unable to retrieve valid incident ID. Please refresh the page and try again.");
        return false;
    }

    var assignmentGroup = g_form.getValue('assignment_group');
    var assignedTo = g_form.getValue('assigned_to');

    console.log("assignment_group: " + assignmentGroup);
    console.log("assigned_to: " + assignedTo);

    var timestamp = new Date().getTime();
    var dialog = new GlideDialogWindow('Notification Settings', 'incident_webhook_form');

    dialog.addParm('incident_sys_id', sysId);
    dialog.addParm('assignment_group', assignmentGroup || '');
    dialog.addParm('assigned_to', assignedTo || '');
    dialog.addParm('_ts', timestamp);

    dialog.setSize(750, 'auto');
    dialog.adjustBodySize();

    dialog.render();

}

 ui pages:

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <g:ui_form>
        ...
 		<g:dialog_buttons_ok_cancel ok="return submitForm()" cancel="return closeDialog()" />
    </g:ui_form>
</j:jelly>
function closeDialog() {
	GlideDialogWindow.get().destroy();   // No
       // window.opener.location.reload();    No
	return true;
}

Uncaught TypeError: GlideDialogWindow.get is not a function 

0 REPLIES 0