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 add javascript to value field?

Jared Wason
Tera Guru

Hi,

I am trying to set the background of a field to blue if the user has more than 1 PC assigned to them. I believe my script include is setup properly since it worked when running it in Background-Script, I think I just need to adjust "if(javascript:countAssignedTo(current.u_itd_customer))>1;". Anyone know how I need to adjust this?

 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION
8 REPLIES 8

Harsh Vardhan
Giga Patron

try now

 

javascript:countAssignedTo(current.u_itd_customer)>1

you dont need to use if() in value field 

Hi, I tried that and still doesn't work for me. I have even tried 'javascript:1>0' just to test and it still isn't triggering my style rule. 

just confirming here.

how are you testing it ? because when you apply some condition on "value" field then field style will be applicable for list view. 

 

condition which i had suggested is correct and it will work. please confirm where are you testing it ? on list or form ?

javascript:countAssignedTo(current.u_itd_customer)>1