- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 09:55 PM
Hi
How do i change the background color for info message (Normally we get info message in blue color but in my case i need to get it in different color).
Could you please suggest for my approach
Regards
Aarya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 06:12 AM
Hello Aarya,
There are additional message types that you can use:
g_form.addWarningMessage = yellow
g_form.addErrorMessage = red
g_form.addInfoMessage = blue
you can change the font color using the following script:
var message1 = 'TEST';
var message2 = message1.fontcolor("red");
g_form.addInfoMessage(message2);
You can also use text background high-lighting such as:
var message = '<b><p style="color:black;background-color:orange;">';
message+='TEST';
g_form.addInfoMessage(message);
or
var message = '<div style="background-color:blue;color:white">Assignment group changed.<br/>';
g_form.addInfoMessage(message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 10:16 PM
Hi,
you can add html tag for that
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 10:18 PM
Hi,
Example: you can add color to the text but not the other one
Display business rule for this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var str1 = '<p style="background-color:tomato;">This is my message</p>';
gs.addInfoMessage(str1);
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 03:23 PM
To keep the text of your info message nicely in the one line you can change it slightly:
var str1 = '<p div style="background-color:tomato; display: inline-block;">This is my message</p>';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 10:17 PM
Hi,
There are no ways to change color of info Messages, you can see below link listed possible ways to use messages, alerts etc in ServiceNow.
If you want to show some messages on form for fields then we can use macros or annotations to show custom UI elements.
Thanks,
Anil Lande
Thanks
Anil Lande
Hope this helps. Please mark the answer as correct/helpful based on impact.