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

Hitoshi Ozawa
Giga Sage
Giga Sage

@Dinh Nguyen Check branding color.

  1. "Service Portal" > "Service Portal Configuration".
  2. Select "Theme Colors" tab.
  3. Check color that's assigned to "Danger"
  4. If necessary, click on "Reset Changes" to revert to default

HitoshiOzawa_2-1731314786233.png

 

 

Hi @Hitoshi Ozawa ,

Thanks for responding to me.

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

I noticed this happens to Portal ESC but for other Portals like Service Portal, the error message is still red.

@Dinh Nguyen Have you tried if changing the type to "warning" changes the color? If it doesn't, there may be some other script running. Contact NowSupport because it may be a bug.

Hi @Hitoshi Ozawa, I tried both 'info' and 'warning', all works except 'error'.

@Dinh Nguyen Checked the generated html. It seems like css for class "bg-error" is to just change the color of the text without changing the background color. If I change it to "bg-warning" or "bg-info", the background color changes. It's either a bug or ServiceNow's spec. Need to ask NowSupport to determine which it is.

HitoshiOzawa_0-1731397205385.png

 

Nevertheless, to make the background color red,

  1. Go to "Service Portal" > "Pages"
  2. Search "ID" = "sc_cat_item"
  3. In "Page Specific CSS", enter
    .form-group .bg-danger {
     background-color: #FF0000;
      color: #FFFFFF;
    }

Execution result:

HitoshiOzawa_1-1731398015948.png