The CreatorCon Call for Content is officially open! Get started here.

Popup confirmation with multiple buttons

ashwani_eshoppi
Kilo Expert

I want to build an Alert once any incident gets resolved.

The popup needs to have confirmation buttons -   'Yes' , 'No' and 'Cancel' .

On click of 'Yes' or 'No' need to do actions on server side.

If i simply put an alert it shows only Ok and Cancel.

Has anyone implemented such confirmation box before?

28 REPLIES 28

ashwani_eshoppi
Kilo Expert

Also a point to note, like i said before, if i set value to 7 instead, the popup autocloses updating the current opened incident



function clickedNo()


{  


      g_form.setValue('state',7);


  gsftSubmit(gel('sysverb_update'));


}


in your onsubmit script you are checking for the state value .. gsftSubmit submits the form and thus invoking the onsubmit script ..



This line


if (incidentState == 6){



Hence the dialog again pops up


ashwani_eshoppi
Kilo Expert

Okay that makes sense ! So how do i avoid that as i need to show this popup onSubmit itself.


add some condition to the if condition on the onsubmit script so that it is not invoked again ...


Try making use of this function in your condition



http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29#getActionName



Such that the onsubmit script gets executed only if the button is clicked initially and not everytime ... That will solve your problem...