Replacement for javascript alert

Rahul Kathuria
Tera Expert

Hi All,

We are using standard javascript(underlined) alert which gives the below pop up message when i click on certain application. Is there any way i can make this pop up message more fancier, it should look good and i want to insert my company's logo in the popup message. I am currently on Eureka version.

    for(var j = 0; j< selectedOptions.length; j++){

    if(selectedOptions[j].value == '8ed97438d8121a40c64c9be40e87a4b8'){//check for Consultant Pharmacist Package

  moveSelectedOptions(selectedIDs, rightBucket, leftBucket); //move the options

  alert("Selecting this option will move certain Applications to Right side bucket as a Package.");  //remove none option from right

find_real_file.png

1 ACCEPTED SOLUTION

Here are the steps to install SweetAlerts (just tested it in my developer instance):



  1. Download SweetAlerts from ServiceNow Share (you'll need to login with your HI credentials / register if you've never used it before)
    1. The file saved will be called: SweetAlerts-V1.1.XML
  2. Once you have the XML file, you can import it from any table using the "Import XML" function in list view:
    1. I did this on "Retrieved Update Sets" since this is where the update set will appear after the import.
      1. ImportXML.png
    2. Once the file is imported, you will see a new entry on "Retrieved Update Sets" called "SweetAlerts-V1.2" in a state of "Loaded"
    3. Preview and Commit the Update Set. It will add 4 new items to your instance:
      1. Style Sheet (SweetAlert.css)
      2. Schedule Item (Share Install Logger) -- Marks that you've installed something from share, as to give the original author credit
      3. UI Script (globalsweetalerts)
      4. UI Script (SweetAlerts-min)



I tested this in a Geneva instance, but have used it in Fuji as well. Since its essentially Javascript hanging out in a UI Script, there shouldn't be any problems with it running in Eureka.


View solution in original post

7 REPLIES 7

Rahul Kathuria
Tera Expert

Thanks Mike, it worked.



1 concern: logo which i inserted is very small and hardly visible. where can i control the size of the logo?. i defined the image in the image module.



for(var j = 0; j< selectedOptions.length; j++){


    if(selectedOptions[j].value == '8ed97438d8121a40c64c9be40e87a4b8'){//check for Consultant Pharmacist Package


  moveSelectedOptions(selectedIDs, rightBucket, leftBucket); //move the options


  swal({ title: "",text: "Selecting this option will move certain Applications to Right side bucket as a Package.", imageUrl: "cvslogo.png" });




find_real_file.png


Rahul Kathuria
Tera Expert

Hi Mike, is it possible to increase the size of logo message?



I defined the specific size in the script itself but its not working..


imageUrl: 'cvs_logo.jpg',


  imageWidth: 600,


  imageHeight: 400,


Rahul (good morning!),



It looks like you can (I personally haven't done it), but I found in the documentation (from GitHub) that you should be able to pass the following:



imageSize"80x80"If imageUrl is set, you can specify imageSize to describes how big you want the icon to be in px. Pass in a string with two values separated by an "x". The first value is the width, the second is the height.

So, your syntax should probably look like this:


        imageUrl: 'cvs_logo.jpg',


        imageSize: '600x400',



Give that a try and see if it works.