showFieldMsg in client script not showing in red color for type "error" in Employee Center

Sruthi17
Mega Sage

In Employee center, 

For one of the catalog item, I have a client script such as when some conditions are met error message should be shown.

This is the script I tried in my PDI

Sruthi17_0-1747372587173.png

Im expecting to see the error message in red color, but its simply a text without any color highlights

Sruthi17_1-1747372644104.png

When I try the same in native view, its working as expected 

Sruthi17_2-1747372685220.png


Can someone help me understand what is the issue here? 
I experienced this issue in my client insatnce and I tried to replicate the same in my PDI and results are same. The error type is not highlighted in RED.

 

 

4 REPLIES 4

Service_RNow
Mega Sage

@Sruthi17 

 

Use g_form.addErrorMessage() (Top-of-form message)

If you don’t need it tied to a specific field, this is the most reliable for red error messages:

g_form.addErrorMessage('Please fill in all required fields.');

This appears in red and is fully supported in Employee Center and Service Portal.

@Sruthi17 

You’re using something like this:

g_form.showFieldMsg('field_name', 'This is an error message', 'error');

But in Employee Center, this doesn't show in red or doesn't render as expected.

Hi @Service_RNow , Thank you for your reply.

But I dont understand why its not supported in Employee center.
Is it a known bug or something?

@Sruthi17 
Not a classic form: The Employee Center uses different rendering technology, often based on Service Portal widgets or Now Experience components, which do not include g_form or GlideForm-based rendering.

 

Use g_form.addErrorMessage() (Top-of-form message)

If you don’t need it tied to a specific field, this is the most reliable for red error messages:

g_form.addErrorMessage('Please fill in all required fields.');

This appears in red and is fully supported in Employee Center and Service Portal.
Please mark reply as Helpful/Correct, if applicable. Thanks!