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

this should be a BR issue.. try activating debug and find the BR causing this .....


Kalaiarasan,



Can you please explain this sentence?



if(typeof window == 'undefined')



What it supposes to do?



Thanks for all your help


it is supposed to hold your server side script when you want to use both, client side and server side code to be executed by a UI action


Hello,


I have used some of the examples here on the Copy UI Action. Any idea why the code in answer=true would not work?



function copyTicket(){


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


      if (answer==true)


              {


        var chgID = current.sys_id.toString();


  var newChange = new GlideRecord('change_request');


  newChange.initialize();


  newChange.requested_by = current.requested_by;


  newChange.cmdb_ci = current.cmdb_ci;


  newChange.type = current.type;


  newChange.assignment_group = current.assignment_group;


  newChange.assigned_to = current.assigned_to;


  newChange.short_description = current.short_description;


  newChange.description = current.description;


  newChange.impact = current.impact;


  newChange.priority = current.priority;


  newChange.change_plan = current.change_plan;


  newChange.test_plan = current.test_plan;


  newChange.backout_plan = current.backout_plan;


  newChange.u_reason_for_change = current.u_reason_for_change;


  newChange.u_implementation_effect = current.u_implementation_effect;


  newChange.u_verification_plan = current.u_verification_plan;


  newChange.insert();


      }


      else


              {


              return false;


      }


}


if (typeof GlideSysAttachment != 'undefined'){


  GlideSysAttachment.copy('change_request', chgID, 'change_request', newChange.sys_id);}


  else{


Packages.com.glide.ui.SysAttachment.copy('change_request', chgID, 'change_request', newChange.sys_id);


  copychg();


gs.addInfoMessage('Change ticket ' + newChange.number + ' created.');


  action.setRedirectURL(newChange);}


first question, i haven't looked at the code yet.. but is the 'client' checkbox selected in the ui action????