Color Changing field based on the Choice

Lavanya11
Kilo Sage

I have a requirement of changing color of a field based on the select box. In a Custom form, there is a choice field. Based on the choice, two string fields has to change its color and shape. I am able to change the color by writing the client script( found somwhere in the community). But it is possible to change the shape?

 

var grValue = g_form.getValue("u_relevance");
var myField = 'u_document_status';
var myAudit = 'u_audit_status';
var ctrl = g_form.getControl(myField);
var ctrl_one = g_form.getControl(myAudit);
if(grValue == 1)
{
ctrl.style.fontWeight = 'bold';
ctrl.style.backgroundColor = 'Red';
ctrl_one.style.fontWeight = 'bold';
ctrl_one.style.backgroundColor = 'Red';
}
else
{
ctrl.style.fontWeight = 'bold';
ctrl.style.backgroundColor = 'Green';
ctrl_one.style.fontWeight = 'bold';
ctrl_one.style.backgroundColor = 'Green';

}


}

This script functions good. But normally the field will be rectangle in shape. Can I change it to round shape. Is it possible to do?

8 REPLIES 8

find_real_file.png

the dictionary attribute "age" maxlength is 2

For rounded-shape, the height and width should be of same dimension.

I saw  this KB Article "https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0695430". The Width cannot be adjusted. Because it depends on the column