- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:44 AM
Hello All,
I am using London instance and want to highlight the 'Requester' field with the Red colour text and VIP flag on the Service Request(sc_request) table. Since this is an OOB functionality already available for the Incident table, i copied required client script and made the changes to accomodate the sc_request table. Below is my script:
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.sc_request.u_requester');
var callerField = $('sys_display.sc_request.u_requester');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('u_requester', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.sc_request.u_requester').down('label');
var callerField = $('sys_display.sc_request.u_requester');
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: ""});
}
}
When i check the request, i received an error message "onChange script error: TypeError: $ is not a function function () { [native code] }". Please refer attached screenshot.
Could you please help me to solve it?
Thanks & regards,
Jainil Shah
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 05:06 AM
HI,
If you want to use this $ code then you have to do one change on that client script.
Can you check Isolate Script flag on client script. Whether it is true or false.
It should be false to allow your DOM manupilation to work.
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:59 AM
have you added the properties to enable the DOM manipulation on London release? because by default on client script it has been disabled..
glide.script.block.client.globals
adding one thread here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 05:06 AM
HI,
If you want to use this $ code then you have to do one change on that client script.
Can you check Isolate Script flag on client script. Whether it is true or false.
It should be false to allow your DOM manupilation to work.
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 05:45 AM
Hello Ashutosh,
Could you please tell me how to check Isolate Script flag?
The strange part is, it worked well for the script on the Incident form. Is it because it's OOB?
Thanks & regards,
Jainil Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 07:21 PM
how do you check isolate Script flag? I did not find it on my catalog client script.
