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

SweetAlert - a beautiful replacement for javascript's "alert"

Matt Saxton - G
Kilo Guru

 

SweetAlerts2 is out. 

 

SweetAlerts2

 

Hi Dev's,

 

Last night i was working on an application that needed some input. So i used SweetAlerts on the custom UI page and it turned out really nice looking, and i thought i could use globally!.

 

ServiceNow Share - SweetAlert

 

Once you install you can do any of the tests via the console

 

parent.swal({     title: "Are you sure?",     text: "You will not be able to recover this imaginary file!",     type: "warning",     showCancelButton: true,     confirmButtonColor: "#DD6B55",     confirmButtonText: "Yes, delete it!",     closeOnConfirm: false }, function(){     swal("Deleted!", "Your imaginary file has been deleted.", "success"); });

 

Make sure that you use "parent.swal()"

 

Here's more examples listed here SweetAlert

 

Screenshot's below.

 

2015-10-01 13_48_38-ServiceNow.png

 

2015-10-01 13_37_06-ServiceNow.png

44 REPLIES 44

Hey Nicholas, here's a link to the master   after downloading follow the steps (here) for method 3



...try it out on your personal and let me know if you have any issues.


James_Neale
Mega Guru

Nice one, Matt!


matthew_magee1
Giga Guru

Hi Matt,



I'm able to call the alert from a console, but my next task is to call it from a business rule.


Example: INC priority = Critical.



I've added the following script to my business rule:


parent.swal({title: "so sweet"});



Nothing happens. Any suggestions?


Thanks much-


Matthew


Matthew,



SweetAlert is a replacement to the standard alert, and as far as I know, like alert, is only available client-side. Try putting it into a client script.


Hey Mike,


Thanks for the quick reply.


I thought about the client script too but that will only affect the user who makes a change on the INC form.


We have an Operations Center w/ a dozen or so people. When a critical INC ticket comes in, we want this alert on ALL the screens of the Operations Center (those who are logged in).



I figured the business rule would be the best option so all of our team would get the alert



Matthew