- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 01:08 AM
Hello... can someone help me? I have a variable set that i configure client script on it. That client script working well in item, but its not working on order guide. I have choose ui type to all. please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 02:36 AM
i found this link. and when i upgrade my instance, client script its working now. thank you all. 😄
https://hi.service-now.com/kb_view.do?sysparm_article=KB0689536
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 01:29 AM
Think you need to supply the code you have in the script so we can see what you've done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 02:13 AM
Maybe some issue with getReference?
Best practice is to use GlideAjax and that works for me at least. I'll provice some sample code you can modify to your needs
Catalog Client Script (onChange)
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//AJAX call to lookup Requested for information
var ga = new GlideAjax('demoUtils'); //Name of Script Include
ga.addParam('sysparm_name','requestedForValues'); //Function in Script Include
ga.addParam('sysparm_requestedFor', newValue); //Parameter to pass to function
ga.getXML(setData);
}
function setData(response) {
var answer = JSON.parse(response.responseXML.documentElement.getAttribute("answer"));
if (answer){
g_form.setValue('demo_user_id', answer.rf_uid);
g_form.setValue('demo_mobile_phone', answer.rf_mPhone);
}
}
Script Include
var demoUtils = Class.create();
demoUtils .prototype = Object.extendsObject(AbstractAjaxProcessor, {
requestedForValues: function() {
var rf = this.getParameter('sysparm_requestedFor');
//Get the User Record for Requested For
var gr = new GlideRecord('sys_user');
gr.get(rf);
//Create an object with parameters
var obj = {};
obj.rf_uid = gr.getValue('user_name');
obj.rf_mPhone = gr.getValue('mobile_phone');
return JSON.stringify(obj);
},
type: 'demoUtils '
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 02:55 AM
the client script is working before in order guide or item. but after doing cloning, i have realized that client script not working in order guide. Did i have doing wrong before it? can i trace what do i do before that script not working anymore?
I have variable set name "informasi user" in order guide, this variable set have client script for load user information. and in item i add variable set name "non-script informasi user" that didn't include script on it. i thick cascade on order guide, so that information in order guide will include to item. I do it because i need information user for notification. i did'nt know how to take variables value from order guide.