Show Field Message Error after Version Up From Vancouver to Xanadu

Dinh Nguyen
Kilo Sage

Hello everyone,

After my instance was versioned from Vancouver to Xanadu, my error message field display was no longer red but black as shown in the picture.

Does anyone know the reason why and how to fix it? Please help me.

Thank you so much.

DinhNguyen_0-1731295041755.png

Here is my code:

function onLoad() {
   g_form.showFieldMsg('requested_reason', 'Low impact not allowed with High priority', 'error');
}
1 ACCEPTED SOLUTION

Hi @Hitoshi Ozawa ,

Thanks for helping me and I apologize for the late response.

ServiceNow responded to me that it was not an issue. I also found a solution which is to create Catalog Client Script and use the code below for handling DOM:

 

setTimeout(function() {
        if (window != null) {
            //comment
        } else {
            var aTags = this.document.getElementsByClassName("bg-danger");
            for (var i = 0; i < aTags.length; i++) {
                aTags[i].style.color = 'red';
            }
        }
    }, 0);

View solution in original post

16 REPLIES 16

Community Alums
Not applicable

Hi @Dinh Nguyen ,

one last easy thing you can try , try clearing the browser cache and instance cache cache.do and try again.

 

Hi @Community Alums,

 I tried your new suggestion but still not working.

 

Ravi Gaurav
Giga Sage
Giga Sage

Hi @Community Alums ,

 

You can try the below code that might help you .. or as suggested by @Community Alums ..

function onLoad() {
    g_form.showFieldMsg('requested_reason', 'Low impact not allowed with High priority', 'error');
   
    // Add custom CSS to make the error message red
    var errorMessage = g_form.getFieldMsg('requested_reason');
    if (errorMessage) {
        errorMessage.style.color = 'red';
    }
}



--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Hi @Ravi Gaurav,

Thanks for responding to me.

I tried your solution, but it doesn't work.

Hitoshi Ozawa
Giga Sage
Giga Sage

@Dinh Nguyen I just tested the script on my Xanadu PDI and it showed up as below. The background color of the message is red. Maybe there's something else like UI Policy or some other script?

HitoshiOzawa_0-1731313798177.png

 

EDIT: Tested on Service Portal and the message appears as below. The color of the error message text if red though.

HitoshiOzawa_1-1731313990095.png