Change "read only" field color on case form

sid23
Mega Contributor

Hi,

We have "opened by" field as read only and we want to change the color of it to red. Now when its not read only i am able to change the color to red with the help of below client script but when its read only i am not able to. Any suggestions?

 

Script - 

function onLoad() {
var x = g_form.getReference('opened_by');


var openedByField = g_form.getElement('sys_display.' + g_form.getTableName() + '.opened_by');
if (x.vip == 'true')
openedByField.setStyle({color : "red"});
else
openedByField.setStyle({color : ""});
}

6 REPLIES 6

Mrigank Gupta
Giga Expert

Try below script :

g_form.getControl(<field>).style.backgroundColor = color;

Hello Gupta,

Below is the script - 

function onLoad() {
var x = g_form.getReference('opened_by');

var openedByField = g_form.getElement('sys_display.' + g_form.getTableName() + '.opened_by');
if (x.vip == 'true')
openedByField.setStyle({color : "red"});
else
openedByField.setStyle({color : ""});
}

 

Can you guide me where to include the above script you have mentioned?