GlideModal call back function not working - error - Uncaught ReferenceError: <<name of callback function>> is not defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 02:28 AM
I am trying to replicate the functionality of Cancel Change request on one of my custom form.
I created exactly same UI Action (Cancel Change) and UI Page (change_confirm_cancel) as that of OOTB change cancel functionality.
However, I am able to get dialog window to enter the comments but when I click on OK button on the dialog box, it does nothing (dialog doesn't get closed) and I can see error in browser debug window:
VM7492:4 Uncaught ReferenceError: moveToCancel is not defined
at HTMLButtonElement.cancelChangeRequest (eval at evalScript (js_includes_doctype.jsx?v=03-02-2020_2243&lp=Tue_Mar_03_02_34_58_PST_2020&c=5_59:84), <anonymous>:4:3)
cancelChangeRequest @ VM7492:4
Interestingly, same OOTB functionality, with same code works fine in Change management.
Any help appreciated.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2020 06:59 AM
Hello Ricardo Trejo,
You have to use "processing script" in UI Page.
You can find more details on docs - https://docs.servicenow.com/bundle/paris-application-development/page/script/server-scripting/reference/r_UIPages.html
HTH.
Regards,
Sourabh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2021 11:10 AM
Hi Sourabh/Ricardo,
Could you please provide more details around how exactly you used the processing script in UI page to resolve this issue? I am running into the same issue.
Regards,
Chris
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 04:13 AM
I've faced the same issue.
I couldn't find anyone in community talking about this except this one (https://www.servicenow.com/community/now-platform-forum/how-to-create-a-popup-dialog-box-on-a-ui-act...).
So as a workaround I've cloned the OOB UI page (change_confirm_cancel) and I've defined the function moveTocancel in the client script of that UI page.
"sys_ui_page.do?sys_id=83972214c3322200b6dcdfdc64d3ae3c&sysparm_record_target=sys_ui_page&sysparm_record_row=6&sysparm_record_rows=12&sysparm_record_list=nameCONTAINScancel%5EORDERBYname"
in the client script:
function cancelChangeRequest() {
var textArea = $("change_confirm_reason_text");
if (textArea)
moveToCancel(textArea.value.trim());
}
function moveToCancel(notes){
// your logic here
}
(function() {
$("change_confirm_reason_text").focus();
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 03:01 AM
setCompletionCallback function is not defined in GlideModal Api whereas it is defined in GlideModalForm Api so you can use in GlideModalForm Api.
Thanks