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

I have just checked the existing Field Styles, and most seems to be applying for list view.


But isn't it your requirement is satisfied that now this catches the customer support eyes and they will act upon it immediately.


To make it color in form, you can always go for onLoad script changing the color on the basis of the value of Needed attention.



Mark the answer as resolved, if it has resolved your requirement


Great news!!!


I set the actual conditions in the BR and it worked like a charm...even better because the Number field gets highlighted both in form and list views...unlike the short_description that only got highlighted in list view!!! Here is my final BR:


Capture.PNG


Once the support changes the state back from 'Awaiting User Info' to Active or any other, the highlighter disappears.



The correct Value in the Field Style is as below:


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



Thanks a lot again!!!


Debashree


Srikanth,



Just need a final clarification....I wouldn't have thought that a before BR would work. Since the changes needs to happen after the user updates the record I would have attempted an after BR which does not work. Can you please explain why the before BR is used in this case?



Many Thanks,


Debashree


Mostly it is because current.comment.changes() by the time the update has already happened in the DB, the comment doesn't hold any data as it is journal field, hence the system will see the comment.changes() never happened.


In case of other type of variables, there is placeholder which holds the data entered.


I have faced this issue, whenever I used current.comment.changes() or currnet.work_notes.changes() - will go for Before BR



Hopefully it helps


Makes perfect sense. Thanks for clarifying!