SweetAlerts2 & ServiceNow

11 February, 2020 - Reading time: 2 minutes

What if we could use the beautiful SweetAlerts2 popup’s together with ServiceNow – wouldn’t that be awesome? This is something I used as a hobby project about a year ago to get better knowledge on SweetAlerts2, but also on some specific (missing?) ServiceNow features.

Description from the SweetAlerts2 site: “A beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript’s popup boxes. Zero dependencies.“.

Attached you’ll find an example of using SweetAlert2 in the ServiceNow platform. More information about SweetAlert2 can be found here: https://sweetalert2.github.io.

The example is based on quickly adding a incident from the list view. A short video demoing the feature can be seen here.

To be able to use SweetAlert2 in the platform there’s an update set on share.

There’s also a portal version which can be found here.

The script include and ui action of what’s shown in the video can be found here in a zipped xml file.

ATM there’s only functions (GlideAjax) in the script include to:

  • Add an incident
  • Get callers dynamically from sys_user and show them in a drop down
  • Get choices from a given field