Apply field styles when a record is updated

Christoffer M
Tera Guru

Hello,

I have a requirement where I need to configure the "Number" field to change style when it's been updated and then change back to normal once the update has been seen by a user.

I've configured a field style to make the "numbers" bold and to display a blue dot, but I'm not sure how to only have it appear when the record has been updated.find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Wojtek Winnicki
Tera Guru

Hello,

in your case I would:

1. Create new field on the table, type choice list, with "Yes, "No" and with "none" option avaible and default. 

2. Create Business Rule with condition "Additional comment -> changes" and action to set your field to "No". Then create list style with value "javascript:current.name_of_your_fiedl == 'No'". This way you have style for the incidents that has been commented. Also you can in BR add other conditions to set this field accordingly.

3. Create Client Script on load, something like this:

function onLoad() {
	//Type appropriate comment here, and begin script below
	if(g_form.getValue('u_user_has_read') == 'no' & g_user.userID == g_form.getValue('caller_id')){
			g_form.setValue('u_user_has_read'', 'yes');
		        g_form.save();
	}
}

This way you will make sure that the Caller has read (or opened the form). The line "g_form.save()" is optional, will cause re-render of the page, but ensure that when the caller have opened the record this fact has been noted by the system. 
(As alternative to the Client Script you can for example create UI Action called for example "Mark as Read" that caller will click. Also maybe even this approach will be better.)
Then create list style with value "javascript:current.name_of_your_fiedl == 'Yes'".


View solution in original post

5 REPLIES 5

Raghu Ram Y
Kilo Sage

Hi,

You need to create two style records like below.. 

find_real_file.png

Change colour names as per your requirement..

Style 1find_real_file.png

Style 2

find_real_file.png

Please mark my response as both CORRECT and HELPFUL, if it helps you.

Wojtek Winnicki
Tera Guru

Hello,

in your case I would:

1. Create new field on the table, type choice list, with "Yes, "No" and with "none" option avaible and default. 

2. Create Business Rule with condition "Additional comment -> changes" and action to set your field to "No". Then create list style with value "javascript:current.name_of_your_fiedl == 'No'". This way you have style for the incidents that has been commented. Also you can in BR add other conditions to set this field accordingly.

3. Create Client Script on load, something like this:

function onLoad() {
	//Type appropriate comment here, and begin script below
	if(g_form.getValue('u_user_has_read') == 'no' & g_user.userID == g_form.getValue('caller_id')){
			g_form.setValue('u_user_has_read'', 'yes');
		        g_form.save();
	}
}

This way you will make sure that the Caller has read (or opened the form). The line "g_form.save()" is optional, will cause re-render of the page, but ensure that when the caller have opened the record this fact has been noted by the system. 
(As alternative to the Client Script you can for example create UI Action called for example "Mark as Read" that caller will click. Also maybe even this approach will be better.)
Then create list style with value "javascript:current.name_of_your_fiedl == 'Yes'".


This does exactly what I need it to do, thank you so much!

Aman Kumar S
Kilo Patron

There is no OOB functionality as such for Incident, you will need to do some custom config to enable this.

This can be retraced to Viewed functionality in KB use table, you can check below info and build similarly for Incident.

1. Create Viewed field on incident as true/false field - check kb_use table for reference

2. Create an event incident.viewed on incident table - refer to kb.view event in event registry

3. Create event action similar to "Knowledge View"

4. Have update/insert BR that triggers this event in step 3 to set viewed field as false, and once the form loads you can set the value as true, and based on this criteria, you can define your field style.

Best Regards
Aman Kumar