Change incident field style when comment is added

dp11
Tera Guru

Hi,

I am required to implement the following:

When a customer replies to an incident that is in a state of "Awaiting User Info", modify the color of the incident number to red.

So, I went to Field Styles and created a new style:

Table: Incident

Field: Number

Value: javascript: current.getValue('state') == '5' && current.comments.changes()

Style: background-color: red

The value of the state "Awaiting User Info" in our system is 5. But this does not work!

Can someone please tell me what I am doing wrong?

Thanks,

Debashree

1 ACCEPTED SOLUTION

ghsrikanth
Tera Guru

Actually your requirement is little tricky, because once the customer updates the Awaiting user info state incident, then the incident number should be highlighted so that customer support can go to that incident fast.


I will advice you to think of a design, because field styles may not work for .changes()


in your requirement you want the hightlight to stay on incident till the customer support acts on.


In this case, define a new field like checkbox, and on the basis of the field keep the color on the number



That checkbox can be updated by a before business rule which triggers when state = Awaiting user info and customer updates the comments


The business rule will make the checkbox (name it like Need Attention) checked


Now define field styles on this field


This will server your requirement fine





Hopefully it helps


View solution in original post

22 REPLIES 22

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Debashree,



Changes made in before business rules are automatically saved when all before business rules are complete, and after business rules are best used for updating related, not current, objects.


Got it. Thanks for clarifying!


however it is important that the comment come from the end user...not from the back end user*