How to change variable background color

ESL
ServiceNow Employee
ServiceNow Employee

I am using service portal to request adding business application record. After I request, it will send the record to approver and the record include variables in service catalog.

I would like to change the background of these variables if the value in variables match some condition.

I tried to use catalog client script such us [g_form.getControl('submitted').style.backgroundColor = 'blue';] script, but it does not work as expected.

 

How can I achieve these requirement?

Please advice, Thanks

 

スクリーンショット 2022-10-05 17.23.31.png

8 REPLIES 8

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Can you check the link I have shared in the notepad

 

Please mark answer correct/helpful based on Impact.

Dan O Connor
ServiceNow Employee
ServiceNow Employee

You could do this using an onLoad Client script. 

 

I've written the below now so havn't checked it in an instance, but think it should work. In the below when submitted is yes the background will go blue. Make sure you are declaring the actual field name, and not its label

 

(New community forum seems to be having some problems so it wont let me post a reply that actual contains the code)

 

 

ESL
ServiceNow Employee
ServiceNow Employee

Thanks for comment. Can you provide some sample code in text? It will be very helpful for me

 

Dan O Connor
ServiceNow Employee
ServiceNow Employee

Community forum has an issue at the moment where it wont let me post replys with code, let me try an attachment