Cancel confirm window after clicking cancel button

jesusemelendezm
Mega Guru

Hi SN folks,

 

What can I use to configure a confirm pop up - when clicking cancel button on the change form. If user press cancel - It will ask confirmation, if press OK - cancel change- if cancel It must return to change form without cancelling the record.

 

Thanks for your help.

1 ACCEPTED SOLUTION

attachment seems not be working for me ....



this is the code ...


Note : check the 'client' checkbox and in 'onlick' field , paste this cancelTicket();



function cancelTicket(){


      var answer=confirm("Are you sure you want to cancel this record?");


      if (answer==true)


              {


              gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action


      }


      else


              {


              return false;


      }


}



if(typeof window == 'undefined')


      {


      current.state = 8;


      current.update();


      action.setRedirectURL(current);


      gs.addInfoMessage('The current change request has been cancelled.');


}


View solution in original post

32 REPLIES 32

Hi,


it didn't work because you used the code for the server side (current, gs etc.)


It would have worked if you used the code for client side "g_form"



function runClientCode(){


var answer=confirm("Are you sure you want to cancel this record?");


  if (answer==true)


  {


            g_form.setValue('state', 8);


            g_form.save();


            alert('The current change request has been cancelled.');


  }


  else


  {


  return false;


  }


}


ohhgr
Kilo Sage

just to add to Kalaiarasan P's reply, use above script as the clientSide Script in the UI Action 'Cancel'.


siva14
Tera Contributor

i need a small help in this, 

 

in service portal if we open any request under the request details we have a cancel button, if we click that button, i want to cancel confirmation message, could you please help me in this

Widget name - "cancel request"

 

find_real_file.png

harikrish_v
Mega Guru

Try this in an onSubmit client script:-



var action = g_form.getActionName();


if(action=="cancel_request"){   //your Cancel button's action name


  var con = confirm('Are you sure you want to cancel this request?');


  if(con){


        gsftSubmit(null, g_form.getFormElement(), 'cancel_request'); //your Cancel button's action name


        }


else{


      return false;


      }


Kalaiarasan Pus
Giga Sage

you dint really gone through the link given in this thread.. did you?


once client checkbox is checked, you cannot directly write server side code... attached is a UI action to explain this and this should answer your question...



mark answered if you find this helpful.....