The CreatorCon Call for Content is officially open! Get started here.

Condition based field styling

Craig Nicholls
Tera Contributor

Hello Guys,

 

I wonder if you could assist me with something, I have recently created a field on my incident table that contains a date which is auto populated by a business rule when a customer visible comment is added to a the worklog, the field is labelled "u_last_customer_update"

 

I would like to expand the functionality of the field and add a condition based colour scheme to the background of the field.

 

Please could you someone tell me if this is possible and if so how I would go about achieving this. What i would like to happen is the background field will change colour based on the time since the current recorded time saved in the field, I would like the following conditions to be applied:

 

within 24 hours - Green

24-48 hours - Yellow

greater than 48 hours - Red

 

thanks in advance

Craig

 

5 REPLIES 5

mdash
Giga Guru

Hi Craig,

Under System UI> Field Styles, you can add an entry for your field. 

You can create a Script include, if your logic is complex and call that function from your field style value field. Or else, you can directly define your condition inside the value field. Please give it a try. An example:

mdash_0-1671543150153.png

In your case, you can create 3 entries for each color. You can create a script include and pass your dates into it, then return the color values based on your above condition.

Please mark my answer as helpful/correct depending on its impact.

Thanks

ConradJ
Tera Contributor

Thanks. We were able to use this to highlight the field based on the date difference as per the below example in System UI >field styles:

 

ConradJ_0-1671602025869.png

 

I am glad this was resolved.

Please mark my answer as helpful/correct depending on its impact.
Thanks

Hello @ConradJ @mdash 

I found your link helpful. I need a small guidance here. 
I am trying to call a script include in the Value of the style. The script include return true. So if the value returned is true then the colour should be changed to green, how do I add this as a condition?

Regards,
Manish