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

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


Yes…perfect suggestion!!! I will try this out and update.


Thanks so much!


Cool, hopefully this should work, let us know


Hi Srikanth,



I have implemented according to your suggestion but still am not getting things to work. In fact I am just testing with a simpler condition. Please see below:



New field in Incident table:


Capture.PNG



Business Rule:


When to Run - Before


Capture.PNG



Field Style:


Capture.PNG



All I am trying to do is to change background color of short description to red if the incident state changes to anything


When I change the state of an incident, the business rule fires and the value 1 gets correctly displayed thru the gs.addInfoMessage(current.getValue('u_needs_attention')


However, there is no color change in short description. I have tried all the following in the Value field of the Field Style:


javascript: current.getValue('u_needs_attention') == true


javascript: current.getValue('u_needs_attention') == 'true'


javascript: current.getValue('u_needs_attention') == '1'


javascript: current.getValue('u_needs_attention') == 1


javascript: current.u_needs_attention == true


javascript: current.u_needs_attention == "true"


javascript: current.u_needs_attention == 1


javascript: current.u_needs_attention == '1'



Any idea about what could be wrong?



Thanks,


Debashree


Actually I just now noticed that it is displaying the red dot in the list view. Does not have any effect in the form field though.


Earlier, before the new field or business rule when I had simply tried the case where Value in Field Style was


javascript:current.getValue('state') == '5' make background color for incidence number as red, it had worked in both the form and the list views.



Any idea why it would not work in the form view now?



Thanks,


Debashree