Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to change font color while using addInfoMessage function ?

Gulzar Manuja2
Kilo Guru

Dear All,

I am populating below messages using addInfoMessage function:

gs.addInfoMessage('Number of roles deleted for current user: ' +sr.getRowCount());

gs.addInfoMessage('Number of active users for whom current user is Reporting Manager: ' +gr.getRowCount());

By Default, system displays the message in blue color and I want to change to font to some other color, say , red.

Request you to let me know how to do the same.

Thanks & Regards,

Gulzar Manuja

1 ACCEPTED SOLUTION

Hey Chuck,



Thanks a lot for your prompt response.



I was just doing hit n trial and got lucky Was able to change the font color by using following:



var message1 = 'Number of groups deleted for current user:' +gm.getRowCount();


var message2 = message1.fontcolor("red");


gs.addInfoMessage(message2);



Regards,


Gulzar Manuja


View solution in original post

8 REPLIES 8

Chuck Tomasi
Tera Patron

Hi Gulzar,



This doesn't appear to be configurable (at least from a business rule. I've tried using something like this:



gs.addInfoMessage(gs.getMessage('my_welcome'));



and then in the System UI> Messages, created a record with the key my_welcome, with a style tag in it. No luck.



Interested to see what others come up with.


Hey Chuck,



Thanks a lot for your prompt response.



I was just doing hit n trial and got lucky Was able to change the font color by using following:



var message1 = 'Number of groups deleted for current user:' +gm.getRowCount();


var message2 = message1.fontcolor("red");


gs.addInfoMessage(message2);



Regards,


Gulzar Manuja


Wow, where did you come up with that?! I love it!


I am glad you liked it...



Well, I would say it was my good luck... Was just trying out few things and one of them worked for me.