Red colour to requested for

Shabbir1
Tera Contributor

Hi team,

 

on RITM we have catalog variables coming from catalog item in those variables one variable name is VIP customer (check box) if that value is true i have to make RITM requested_for to red color can anyone help me in the on load client script or any other possible way

1 ACCEPTED SOLUTION

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Shabbir1 ,

 

See if this helps...

function onLoad() {
var displayControl = g_form.getControl('sys_display.sc_req_item.requested_for'); 
if(g_form.getValue('name_of_your_vip_varaible' == true){
displayControl.style.background = 'red';
}    

 

if it doesnt work then...

 

Use this article to get your issue fixed :

https://servicenowguru.com/ui-scripts-system-ui/modifying-label-form-fields-client-scripts/


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@Shabbir1 Please refer to this thread https://www.servicenow.com/community/developer-forum/highlight-vip-user-in-catalog-task/m-p/2698690 to take inspiration for your onLoad script to highlight the VIP user in requested for.

 

Hope this helps.

Mark Manders
Mega Patron

How is this check box ticked? Is it something the requester does, or do you have automation filling it from the table? If it's the latter, you can easily use the link shared by Sandeep (because it is referencing to a field related to the caller/account/user/company). If it's really just a variable, filled by the requester, it will be hard to update the color, but you should also consider if having this functionality available is a good idea (every customer finds himself a vip). So I hope it's coming from the user/company table.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Shabbir1 ,

 

See if this helps...

function onLoad() {
var displayControl = g_form.getControl('sys_display.sc_req_item.requested_for'); 
if(g_form.getValue('name_of_your_vip_varaible' == true){
displayControl.style.background = 'red';
}    

 

if it doesnt work then...

 

Use this article to get your issue fixed :

https://servicenowguru.com/ui-scripts-system-ui/modifying-label-form-fields-client-scripts/


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Thank you so much @Sohail Khilji for your quick response its working 👍👍