Glide Dialog Window in OnChange Client script

synthia
Giga Expert

Hi All ,

I have a client OnChange script with the following code . To make it ATF compliant , I need to remove the "confirm" box . 

Can anyone please help me how to do it ? Can I use a Glide Dialog Window but i do not have a UI Action .

If yes , how do i get the value after the user clicks "OK" in the dialog box ? 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (!isLoading) {
// check with the user on the action
if ((newValue == 'false') && (oldValue != newValue)) {

if (confirm('Are you sure you want to demote this major incident to a normal incident?')) {
} else {
g_form.setValue('u_major_incident', 'true');

}
}
if ((newValue == 'true') && (oldValue != newValue)) {

if (confirm('Are you sure you want to promote this incident to a major incident?')) {


} else {
g_form.setValue('u_major_incident', 'false');
}
}
}

// get the value of the u_major_incident field to use in the show/hide section below
var majorInc = g_form.getValue('u_major_incident');
var sections = g_form.getSections();
if (majorInc == 'false') {
sections[6].style.display = 'none';
} else {
sections[6].style.display = 'block';
}

}

 

Thank you .

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

confirm box cannot be tested with ATF;

you will require to call GlideDialogWindow which can be tested in ATF

in order for the record to get updated via UI page you need to send the current record sys_id to the UI page and then you can update it in the UI page

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

confirm box cannot be tested with ATF;

you will require to call GlideDialogWindow which can be tested in ATF

in order for the record to get updated via UI page you need to send the current record sys_id to the UI page and then you can update it in the UI page

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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