- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2021 03:24 AM
Hi,
I am getting the below error when my onchange client script is executed.
The script is still working fine but get this error when it does.
The script basically prompts to propose incident as MI when priority is 1 or 2.
This is my script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '' || oldValue == 1 || oldValue == 2) {
return;
}
// if incident already poposed MI then do not run script
if(g_form.getValue('major_incident_state') == 'proposed'){
return false;
}
else {
// Trigger script
}
var priority = g_form.getValue('priority');
if (priority == 1 || priority == 2) {
// This prevents the form from checking if any mandatory fields need filling if the form values change
g_form.checkMandatory = false;
// If cancel is pressed or the dialog is closed the response is empty
var confirm = new GlideModal('glide_modal_confirm', true, 300);
confirm.setTitle(new GwtMessage().getMessage('Propose as MI confirmation'));
confirm.setPreference('body', new GwtMessage().format("Priority 1 & 2 tickets follow the major incident process. Please confirm that you would like to propose this ticket as a Major Incident."));
confirm.setPreference('focusTrap', true);
confirm.setPreference('onPromptComplete', doComplete);
confirm.setPreference('onPromptCancel', doCancel);
confirm.render();
function doComplete() {
var dialog = new GlideModal('sn_major_inc_mgmt_mim_propose', false, 651, 250);
getMessage('Propose Major Incident', function(msg) {
dialog.setTitle(msg);
});
ScriptLoader.getScripts('/scripts/incident/glide_modal_accessibility.js', function() {
dialog.template = glideModalTemplate;
dialog.on('bodyrendered', function(event) {
glideModalKeyDownHandler(event, dialog.getID());
});
dialog.setPreference('WORK_NOTES', g_form.getValue('work_notes'));
dialog.setPreference('BUSINESS_IMPACT', g_form.getValue('business_impact'));
dialog.setPreference("focusTrap", true);
dialog.render();
});
}
callback(true);
function doCancel() {
g_form.setValue('impact', 4);
g_form.setValue('urgency', 4);
priority = 4;
callback(false);
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2021 01:11 AM
Hi, so the error was because the callback(true) was outside the curly bracket above it, it should have been inside it, so put it inside and that fixed it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 06:25 PM
hi
It seems to me that "callback(true);" function is not defined. Can you please comment "callback(true); & callback(false);" and try ?
Mark "correct answer / Helpful" if this is useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2021 01:11 AM
Hi, so the error was because the callback(true) was outside the curly bracket above it, it should have been inside it, so put it inside and that fixed it.