How to display pop-up messages in Service Portal

Ro5
Tera Expert

hello.
I would like to display a pop-up message when the mouse cursor is placed on a widget such as an icon link in the service portal.Is this possible?
If possible, please tell me how.

 

Regards,
Ro

9 REPLIES 9

Sateesh Kumar D
ServiceNow Employee
ServiceNow Employee

Hello,

 

Change 'About us' to reflect title and 'Hooray!' with the message you want to show on hover.

In HTML field : 

<li><a href="" data-toggle="tooltip" title="Hooray!"><i class=" icon-pencil icon-2x"></i>About Us</a></li>

 

In client controller:


$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});

hello.
Do you write to the target widget's HTML and the client controller?

 

Regards,
Ro

Akshay37
Mega Guru

Hi,

You can use below code for this requirement

 

// HTML template 
<button ng-mouseover="c.onAlert()" class="btn btn-default">
    Alert
  </button>

// Client script
function(spModal) {
    var c = this;
  c.onAlert = function () {
        spModal.alert('How do you feel today?').then(function (answer) {
            c.simple = answer;
        });
    }
 }

 

Please Make it helpful/correct if this helps you.

 

Thanks,

Akshay

 

hello.
I'm currently using ServiceNow's default icon link, how do I write the above HTML template into the HTML for that?

 

Also, how do you set the client script table and type?

 

Regards,
Ro

jaheerhattiwale
Mega Sage
Mega Sage

@Ro5 You can use spModal.open() function to show popup.

 

You will get the sample code in the documentation.

 

Link to documentation: https://developer.servicenow.com/print_page.do?release=quebec&category=null&identifier=SPModal-API&m...

 

Mark as correct answer if this solves your issue

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023