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

ghsrikanth
Tera Guru

Try this script-


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



One more concern here can be the whether the current.comments.changes() works or not. In Business rule, it works only in after business rule, so have to see whether current.comment.changes() is working or not.


Thanks for your reply.


Actually, the current.getValue('state') == 5 is the right syntax as without the other condition on comments, it works fine.


So the issue is how to determine when the customer has replied…..


venkatiyer1
Giga Guru

Hi Debashree,



First, i guess state has a integer value so check for



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


I agree with Srikanth, if you have the current.comments.changes() as a part of condition it may not pick up. Just having the state would work, but in Geneva i see the background color change only in list view and not in form view.