Styles

 Client Script

// Setting styles using client code

function setStyle(response, control) {
var style = response.responseXML.documentElement.getAttribute("answer");
control.setStyle(style);
}

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//alert (oldValue + "  " + newValue);
var tableName = g_form.getTableName();
// Change the background color based on status field.
var ajax = new GlideAjax('ProjectStatusColorHelper');
ajax.addParam('sysparm_name', 'setStatusColor');
ajax.addParam('sysparm_value', newValue);
ajax.addParam('sysparm_table_name', tableName);
ajax.addParam('sysparm_field_name', 'u_status');
ajax.getXML(function(response) {
setStyle(response, control);
});
}

Comments

Popular posts from this blog

Email Templates and Emails

Arrays

ServiceNow tips