Issue with popup glideDialog window

Deepthi13
Tera Expert

Hi Team,

I am getting below error and please find the UI page HTML snippet please guide if there is anything i am missing.


SCRIPT: UI PAGE(HTML)

<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide">
<div style="padding:20px">
<!-- receive sys_id from UI Action -->
<input type="hidden" id="sysparam_sys_id" value="${RP.getParameterValue('sysparam_sys_id')}"/>
<h2>Conflict of Interest</h2>
<p>Do you have a conflict of Interest?</p>

<div style="margin-top:20px">
<button class="btn btn-primary" onclick="submitCOI('YES')">Yes</button>
<button class="btn btn-default" onclick="submitCOI('NO')">No</button>
</div>
</div>

<!-- client script wrapped in CDATA -->

function submitCOI(answer) {
var sysIdEl = document.getElementById('sysparam_sys_id');
var sysId = sysIdEl ? sysIdEl.value : '';

// close current dialog safely
try {
var dlg = window.top.GlideDialogWindow.get();
if (dlg) dlg.destroy();
} catch(e) {}

if (answer === 'YES') {
// open second dialog (details page)
var dlg2 = new GlideDialogWindow('review_coi_yes_details'); // second UI PAGE
dlg2.setTitle('COI Declaration');
dlg2.setWidth(600);
dlg2.setPreference('sysparam_sys_id', sysId); // pass along sys_id
dlg2.render();
return;
}

// NO -> navigate back to record (classic nav)
var url = 'sn_bom_internal_investigation.do' + (sysId ? ('?sys_id=' + sysId) : '');
if (window.top.g_navigation) window.top.g_navigation.open(url);
else window.top.location.href = '/' + url;
}
</j:jelly>

 

Deepthi13_0-1767617949141.png

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepthi13 

what's your exact business requirement?

how are you opening that UI page?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have an link on related list, once I click the link it should open this pop up, after clicking YES, it should create an FSC task

Deepthi13_0-1767618874692.png

 

@Deepthi13 

then it's an easy requirement

-> use GlideModal to open UI page and show message

-> have Yes/No buttons and then on click of that handle the record insertion in UI page client script directly or use GlideAjax

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes i tried almost it came but script is populating below,  

Deepthi13_0-1767678893594.png


UI page - HTML

<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide">
<div style="padding:20px">
<!-- receive sys_id from UI Action -->
<input type="hidden" id="sysparam_sys_id" value="${RP.getParameterValue('sysparam_sys_id')}"/>
<h2>Conflict of Interest</h2>
<p>Do you have a conflict of Interest?</p>

<div style="margin-top:20px">
<button class="btn btn-primary" onclick="submitCOI('YES')">Yes</button>
<button class="btn btn-default" onclick="submitCOI('NO')">No</button>
</div>
</div>

<!-- client script wrapped in CDATA -->

function submitCOI(answer) {
var sysIdEl = document.getElementById('sysparam_sys_id');
var sysId = sysIdEl ? sysIdEl.value : '';

// close current dialog safely
try {
var dlg = window.top.GlideDialogWindow.get();
if (dlg) dlg.destroy();
} catch(e) {}

if (answer === 'YES') {
// open second dialog (details page)
var dlg2 = new GlideDialogWindow('review_coi_yes_details'); // second UI PAGE
dlg2.setTitle('COI Declaration');
dlg2.setWidth(600);
dlg2.setPreference('sysparam_sys_id', sysId); // pass along sys_id
dlg2.render();
return;
}

// NO -> navigate back to record (classic nav)
var url = 'sn_bom_internal_investigation.do' + (sysId ? ('?sys_id=' + sysId) : '');
if (window.top.g_navigation) window.top.g_navigation.open(url);
else window.top.location.href = '/' + url;
}
</j:jelly>