Highlight VIP user in sc_task table

RobertPC
Tera Contributor

Good morning, I have a client side script that runs on the sc_req_item to highlight the requeted_for file if the user is a VIP. It works great in the sc_req_item, but I cannot get it to work in the sc_task table. Below is the Client side script I am using. Any help with this would be greatly appreciated:

 

function onChange(control, oldValue, newValue, isLoading) {
    var callerLabel = $('label.sc_task.request_item.requested_for');
    var callerField = $('sys_display.sc_task.request_item.requested_for');
    if (!callerLabel || !callerField)
        return;
   
    if (!newValue) {
        callerLabel.setStyle({backgroundImage: ""});
        callerField.setStyle({color: ""});
        return;
    }
    g_form.getReference('request_item.requested_for', vipCallerCallback);
}

function vipCallerCallback(caller) {
    var callerLabel = $('label.sc_task.request_item.requested_for').down('label');
    var callerField = $('sys_display.sc_task.request_item.requested_for');
    if (!callerLabel || !callerField)
        return;
   
    //check for VIP status
    if (caller.vip == 'true') {
        var bgPosition = "95% 55%";
        if (document.documentElement.getAttribute('data-doctype') == 'true')
            bgPosition = "5% 45%";
           
        callerLabel.setStyle({backgroundImage: "url(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
        callerField.setStyle({color: "red"});
    } else {
        callerLabel.setStyle({backgroundImage: ""});
        callerField.setStyle({color: ""});
    }
}
1 ACCEPTED SOLUTION

Hi @RobertPC 

 

No need to do scripting

 

https://INSTANCENMAE.service-now.com/now/nav/ui/classic/params/target/sys_ui_style_list.do%3Fsysparm_userpref_module%3Dc5cc1c4cc0a80164013e846f439f500f%26sysparm_clear_stack%3Dtrue

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @RobertPC 

 

Did you try the field style which is OOTB and worked on incident table.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Yes, I modified the Client Side Script that was created for us in the Incident table. I was able to modify to get it to work in the RTIM table, but I cannot figure out how to modify to work for the SCTASK table.

I believe AG is referring to the OOTB "Field Styles" module (System UI > Field Styles). Take a look at that and see if that gets you what you need!

Hi @RobertPC 

 

No need to do scripting

 

https://INSTANCENMAE.service-now.com/now/nav/ui/classic/params/target/sys_ui_style_list.do%3Fsysparm_userpref_module%3Dc5cc1c4cc0a80164013e846f439f500f%26sysparm_clear_stack%3Dtrue

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************