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

Since you mentioned it, I had to go look and experiment. It looks like fontcolor() is a standard JavaScript string method. It adds both classic <font> tag and <style> tags to the string (belt and suspenders, I guess.)


Yes Sir, I think so !!!!


fkhan
Kilo Guru

Hi Gulzar,


You may find below links helpful.


Re: addInfoMessage


Community Code Snippets - Logging: Some Notes on Business Rules



Hit like, Helpful or Correct depending on the impact of the response


Thannks,


Farukh


Hey Farukh,



Thank you for your response.



Actually I went through this hyperlink and tried to change the font using the mentioned example but I could not.



It is quite possible that I wasn't able to use it properly as I am new to javascript programming.



Regards,


Gulzar Manuja