Is it possible to use a script include as value to define a field style?

cinthyareatiga
Giga Contributor

Hi,

I have a field called "Problem" in the incident form, which I need to change the backgroung color base on 3 conditions, one of those is a query in another table. So, I need to use a script include to make the server query.

I wonder if I can use this script include as the evaluator in the "Value" field of the Style record for the "Problem" field?

Thanks.

1 ACCEPTED SOLUTION

Sorry, got interrupted and hit Post too quickly...



Since it appears that this is fixed in another release, there's not much more for us to do here.



For those viewing this later... The following field style value does not highlight the cell with the background-color:tomato in Geneva Patch 5. It appears to work fine in Geneva Patch 6.



javascript:true


View solution in original post

17 REPLIES 17

Chuck Tomasi
Tera Patron

Hi Cinthya,



Yes, you may do this. The script include really just needs to return a true or false to get it to turn the color you want. The value field would look like this:



javascript:myColorChecker(current);



I like to pass the current record so I have access to all the wonderful fields and properties of the current record.


Abhinay Erra
Giga Sage

I believe you can, but it should return either true or false


javascript: new scripIncludeName().methodName();


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Cinthya,



You may find below thread helpful.


Passing a variable to a script include from a style value field