Field style on list view for related field

Alex Macdonel
Tera Expert

I'm adding a field style to highlight VIP users on list views for Requests, Requested Items and Catalog Tasks very much like the out of box behavior for Incidents.

On the Request level all works fine but I can't figure out how to make it work on the RITM and Catalog Task level. The two ticket types have no 'requester' and instead I rely on the related field request.requested for (for the RITM) and   request_item.request.requested_for (at the catalog task) level.

Is there a way to do the highlighting for fields on related tables in the list view?

Thanks,

Alex

3 REPLIES 3

shane_davis
Tera Expert

Hi Alejandro,



      I am trying to do the same thing.   REQ works great, but RITM and CTASK won't work.   Thank you for any help you can provide.   Below is my code for the REQ client script just so it's in this article.



Client Script


Type:   onChange


Field name: Requested for



function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.sc_request.requested_for');
var callerField = $('sys_display.sc_request.requested_for');
if (!callerLabel || !callerField)
  return;

if (!newValue) {
  callerLabel.setStyle({backgroundImage: ""});
  callerField.setStyle({color: ""});
  return;
}
g_form.getReference('requested_for', vipCallerCallback);
}


function vipCallerCallback(requestor) {
var callerLabel = $('label.sc_request.requested_for');
var callerField = $('sys_display.sc_request.requested_for');
if (!callerLabel || !callerField)
  return;

//check for VIP status
if (requestor.vip == 'true') {
  callerLabel.setStyle({backgroundImage: "url(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: "95% 55%"});
  callerField.setStyle({color: "red"});
} else {
  callerLabel.setStyle({backgroundImage: ""});
  callerField.setStyle({color: ""});
}
}


Copied this code in exactly and unable to get it functional on the REQ level.



Looking to get the field Requested_for to display the name letters in red font colors if a VIP.



Simply not working!


Have tried


1. Client Script for onChange


2. Client Script for onLoad


3. Field style for [sc_request] Requested_for.


NONE OF THESE WORK!!!


Robert - Attached are text files of the client scripts for you.   I included CALL tickets in case you do/will start using them.