How to show the VIP icon beside field "Requested for" on RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 03:05 AM
I Can see one on change client script is already written on incident table to show the VIP icon beside field "caller".
"However now i have created the same script as on load for ritm table then this script is not working.
In the below script of ritm record i am able to show the error message "test" but the next error message "test4" is nlt getting printed seems like the issue is ith line no. 3, please suggest what wrong here.
function onLoad(){
g_form.addErrorMessage('test');
var callerLabel = $('label.sc_req_item.request.requested_for');
g_form.addErrorMessage('test4');
var callerField = $('sys_display.sc_req_item.request.requested_for');
g_form.addErrorMessage('test1');
g_form.addInfoMessage(callerLabel);
g_form.addInfoMessage(callerField);
g_form.addErrorMessage('test2');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('request.requested_for', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.sc_req_item.request.requested_for').down('label');
var callerField = $('sys_display.sc_req_item.request.requested_for');
if (!callerLabel || !callerField)
return;
//check for VIP status
if (caller.vip == 'true' && caller.u_special == 'false') {
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 if(caller.vip == 'false' && caller.u_special == 'true'){
// alert('inside else if');
bgPosition = "95% 55%";
if (document.documentElement.getAttribute('data-doctype') == 'true')
bgPosition = "5% 45%";
// alert('setting css image');
callerLabel.setStyle({backgroundImage: "url(images/icons/power_ups.gif)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
}
else if (caller.vip == 'true' && caller.u_special == 'true') {
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: ""});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 06:27 AM
With below changes, the script should execute successfully and apply the VIP icon styles based on the conditions specified in the vipCallerCallback() function for the ritm record.
function onLoad() {
g_form.addErrorMessage('test');
var callerLabel = $('label.sc_req_item.request.requested_for');
g_form.addErrorMessage('test4');
var callerField = $('sys_display.sc_req_item.request.requested_for');
g_form.addErrorMessage('test1');
g_form.addInfoMessage(callerLabel);
g_form.addInfoMessage(callerField);
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
if (!callerLabel || !callerField)
return;
g_form.getReference('request.requested_for', vipCallerCallback);
}
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 04:58 AM
Hello, i have similar issue and used same script above but it's not working. did you find any solution for this issue?