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 prevent Polaris CSS overwriting custom style?

Tobias Persson_
Tera Expert

Hi Community,

 

the following Catalog Client Script code to color my Question variables works in UI prior to Next Experience:

g_form.getControl('<MY_CONTROL_NAME>').parentNode.style.color = 'rgba(0, 0, 0, 0.4)';

 

But as soon as Next Experience is turned on (which it is in most cases) I can see Polaris CSS overwriting my color styles. When I inspect the element I am able to find my code but it is ignored because Polaris overwrites it. 

 

I tried to do this:

g_form.getControl('<MY_FIELD_NAME>').parentNode.style.setAttribute('color', 'rgba(0, 0, 0, 0.4)', 'important');

But this only threw an error saying setAttribute is not a function.

 

Does anyone know how to change the color on Catalog Item labels that also works in Next Experience?

 

Thanks and regards,

Tobias

0 REPLIES 0