Pop up to confirm cancellation

shristy2
Giga Expert

Hi All,

I have the requirement that : On the incident form their is incident status code as cancelled.

find_real_file.png

When the user clicks on that i want a pop up saying : " Do you want to cancel this incident " and two buttons should be their i.e., Yes or no.

If user clicks yes the ticket should get cancelled and if he clicks no then it should remain in the same page.

Kindly provide your input.

Regards,

Shristy

1 ACCEPTED SOLUTION

raveena2
Kilo Expert

Hi shrishty,


Try this code


function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}




var value = g_form.getValue('incident_state');// field name
if(value==12) // field value
  {
  if(confirm("Do you want to cancel"))
{
g_form.save();
}
    else
    {
    g_form.setValue('incident_state',oldValue);
    }


  }
}



Regards,


Raveena Bhatia



PS:Mark this answer as correct or useful or hit like


View solution in original post

14 REPLIES 14

Hi srinivas ,



Iapplied your code ,popup is working but when i am checking the ticket again the ticket is not cancelled so help me with this.



It should actually get cancelled when the person clicks on cancel and ok.



Regards,


Shristy


Hi Shristy,



In the OOB confirmation box you wont get "Yes",and "No" button.You can get "Ok" and "Cancel" button there.



Thanks,


Mihir


Mihir Mohanta
Kilo Sage

Hi Shristy,



1.Create a on change client script on the state field.


2.Call a GlideDialogWindow from that script when state change to cancelled.In the GlideDialogWindow call a ui page which has two buttons yes and no.


3.Set   value in the state field when user selects yes /no accordingly.You can set value directly from the client script of the UI page.



Please mark it as Helpful/Correct according to its impact.



Thanks,


Mihir


Hi Mihir,



I created a client script confirm cancellation :



find_real_file.png




Kindly help me with the glide dialogue window?



Regards,


Shristy


you need to specify the field name where you want to set the old value



g_form.setValue('field_name',oldValue) ;