wilsmi
11/1/2016 - 1:40 PM

Updates the highlight VIP caller with a field decoration and colored text if the user is an IT user. *Just be aware, during upgrade testing

Updates the highlight VIP caller with a field decoration and colored text if the user is an IT user. *Just be aware, during upgrade testing in the future: if the DOM changes, this might not continue to function.

//$j("input[data-ref='problem.assigned_to']").css('background-color','red');


function onChange(control, oldValue, newValue, isLoading) {
	//var callerField = $('sys_display.incident.caller_id');
	
	// if the caller_id field is not present, then we can't add an icon anywhere
	if (!g_form.hasField('caller_id'))
		return;
	
	if (!newValue)
		return;
	
	var caller = g_form.getReference('caller_id'); // This could be replaced with a REST call to get the u_it value
		
	if (caller.u_it == 'true') {
		g_form.addDecoration('caller_id', 'icon-it', 'IT Person');
		//Just be aware, during upgrade testing in the future: if the DOM changes, this might not continue to function.
		$j("input[data-ref='incident.caller_id']").css('color','blue');
	} else {
		g_form.removeDecoration('caller_id', 'icon-it', 'IT Person');
		//Just be aware, during upgrade testing in the future: if the DOM changes, this might not continue to function.
		$j("input[data-ref='incident.caller_id']").css('color',''); // 
		//input[selector] says only where the tag is input and other selector matches
		
	}
}