What is sweet Alert?

Sweet Alert is a custom dialog library built aiming to replace JavaScript’s “alert” and “prompt” features to provide a fresh and concurrent UI features filled dialogs.

Requirement to integrate

Sweet Alert can be integrated with Service in simple steps. It will work with both UI 15 and UI 16. You need below three codes to integrate it with Service Now.

  • globalsweetalerts –> UI script
  • SweetAlerts-min.js —>UI script
  • SweetAlerts.css –> CSS file.

You can download the update set from Service Now share and import in your instance. If you do not have access to Share Site, Here is the link to download Sweet alert files Sweet Alert.

  • Search for files “SweetAlerts-min.js”, “SweetAlerts.css” and “globalsweetalert” under folder dist.
  • Open above three files in any editor.
  • Create a new UI script with same name to (your wish) i.e. “SweetAlerts-min.js” and paste the content of files in it through list view (as you will get error through form view).
  • Create new stylesheet with same name and paste the content of files in it through list view.

Create a new Global UI script and paste content of file “globalsweetalert”.

How to use Sweet alert

In the client script, instead of alert, now you can write swal() function for alert messages.
E.g., swal(“Hello world!”);

Sweet Alert Configuration with ServiceNow
Sweet Alert Configuration with ServiceNow

Functions of SweetAlert

There are lots of functions we can call. As it is based on java script you can add java script code within it.
E.g.,
swal(“Click on either the button or outside the modal.”)
.then((value) => {
swal(`The returned value is: ${value}`);
});

For more information about function log onto sweet Alert.

Emergys Blog

Recent Articles

  • Migrating from Remedyforce to BMC Helix

    Enhance Your IT Service Management: Migrating from Remedyforce to BMC Helix

    Enhance Your IT Service Management: Migrating from Remedyforce to BMC Helix

    In today’s rapidly evolving business landscape, organizations must constantly seek [...]

    In today’s rapidly evolving business landscape, organizations must constantly seek ways to optimize their IT service [...]

  • Credit Unions to Accelerate Growth with Cost-Effective Hyperautomation

    Credit Unions to Accelerate Growth with Cost-Effective Hyperautomation

    Credit unions are grappling with evolving customer expectations, economic uncertainty, [...]

    Credit unions are grappling with evolving customer expectations, economic uncertainty, and growing competition from fintech startups, [...]

  • Unlocking the Power of Data Warehouse Migration

    Unlocking the Power of Data Warehouse Migration

    Unlocking the Power of Data Warehouse Migration