ServiceNow GlideDialogWindow to pass data from client script to ui page
Client Script code
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } var gdw = new GlideDialogWindow('ui_page_name'); gdw.setTitle('Confirmation'); gdw.setPreference('sysparm_oldValue', 'oldValue'); gdw.render(); }
UI Page : ui_page_name
HTML
<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <j:set var="jvar_renew_contact" value="${RP.getWindowProperties().get('sysparm_oldValue')}" /> <div> ${jvar_renew_contact} <p>Warning: Changes to Start dates or End dates for a Demand or Project will reset ALL active Resource Plans to a \"Requested\" state, will reset the Resource Plan dates and will require Resource Managers to reapprove all of the associated Resource Plans.</p> <button type="button" onclick="cancelpop1()">Confirm</button> <button type="button" onclick="cancelpop('${jvar_renew_contact}')">Cancel</button> <button type="button" onclick="cancelpop( '${jvar_renew_contact}')">Discard</button> </div></j:jelly>
Client Controller:
function cancelpop(val) { var gdw = GlideDialogWindow.get(); g_form.setValue("start_date",val); gdw.destroy(); } function cancelpop1() { var gdw = GlideDialogWindow.get(); gdw.destroy(); }
ServiceNow GlideDialogWindow to open popup with cancel, discard , confirm button ServiceNow
Working Code Edited question August 3, 2023