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.

Apply colors on Catalog Item variables in Service Portal

varunkumar1
Tera Contributor

Hello All,

 

I would like to apply color on the Catalog Item variables in the Service Portal. I have written an onchange catalog client script using below syntax. The below syntax is working in Desktop view, but not in the Service Portal

control.style = "color:red";

 

In Service Portal, it is showing an error "Javascript console error"

 

Can someone assist me how to apply to apply colors on the catalog item variables in the Service Portal

2 REPLIES 2

Community Alums
Not applicable

Hi @varunkumar1 ,

please follow the below code:-

var getLblParent= g_form.getElement('label name');

var getLblElement = jQuery("label[for='"+getLblParent+"']").css('color','red');

 

Also, refer to an example : https://www.servicenow.com/community/itsm-forum/need-to-change-color-of-variable-on-service-portal-b...

 

varunkumar1
Tera Contributor

Hi Sandeep, 

 

Its not working. It is throwing the same Javascript console error in the Portal