Close
Thank you for your feedback.

Advanced style selection

Advanced style selection

Use a script-based-condition to determine if the system should apply a style to a field in the list.

You can enter a script-based-condition in the Value field with the syntax javascript:<script>. If the evaluated script returns true, the system applies the style to the list item.

The script has access to the current script object, which allows you to build conditions based on the field values of the current record. For example, this script checks for overdue items based on a field value:

 javascript:gs.dateDiff(gs.now(), current.u_datefield.getDisplayValue(), true) < 0

Note: In this example, current.u_datefield refers to the name of a custom date field.

The system only supports one javascript:<script> entry in a Value field. If you want to enter multiple JavaScript conditions, consolidate the conditions into one statement. For example, instead of this invalid entry:

javascript: current.state == "Completed" javascript: current.error_tables > 0

Consolidate the conditions into one statement such as:

javascript: current.state == "Completed" && current.error_tables > 0

Products > ServiceNow Platform > Platform Field Administration; Versions > Helsinki