Creating a OK/Cancel dialog box

Mikolz
Kilo Contributor

Hi everyone, I created a simple UI action that works the way it should. When a user clicks on the button, I want them to be greeted with an OK or Cancel dialog box. Ok would continue with the action and cancel would obviously keep them on the same screen. I know how to script a dialog box, but it doesnt appear that it works in service now? is there some method is servicenow that I need to use to accomplish this? Thanks

4 REPLIES 4

DubeyN
Mega Expert

You can use "confirm" in client script.

var c = confirm ('Please review the information below and select OK to finish submitting your request');
if (c)
{
return true;
}
else
{
return false;
}
}

Regards,
ND


MKhan1
Giga Contributor

i am guessing that you are calling a UI page from your UI Action. If this is the case, then in the g: tag which calls this button have a return before calling the function. for example:

<input type='button' id='myButton' onclick='return myFunction()' />

Hope this helps


MKhan1
Giga Contributor

Here is example tag




<input type="button" id="myButton" onclick='return myFunction()"/>


Mikolz
Kilo Contributor

Thanks for the suggestions guys. I got it to work. Appreciate it!