- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 06:37 AM
I have created variable set ,wrote a script in catalog script and it is not working in service portal. Simple alert is not working. Please guide me If I need to make any changes global to work client script in service portal?
.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:18 AM
Well, it is working fine on my end. Try this, using a callback function
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gp = new GlideRecord('core_country');
gp.addQuery('name', newValue);
gp.query(callBack);
alert('working');
function callBack(gp){
while(gp.next()){
countrycode = gp.iso3166_3;
alert('test');
}
}
//Type appropriate comment here, and begin script below
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 09:15 AM
Now this is getting clumsy. You should do not do this on client side. Use GlideAjax, and do all the glideRecord queries on server side and return the values. Go thru these links
http://wiki.servicenow.com/index.php?title=GlideAjax
https://fruitionpartners.eu/blog/2015/11/17/glideajax-return-multiple-values-using-json/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 09:19 AM
Its working fine Abnay. Thanks for your time

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 09:22 AM
suryareddyn go thru this link How To Mark Answers Correct From Community Inbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2016 12:20 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearOptions('vs_location'); // Clear options from the Location select box
var gp = new GlideRecord('core_country');
gp.addQuery('name', newValue);
gp.query(callBack);
function callBack(gp){
while(gp.next()){
countrycode = gp.iso3166_3;
// get locations using country from the u_citrix_office_locations name
var gp1 = new GlideRecord('u_citrix_office_locations');
gp1.addQuery('u_country_code', countrycode);
gp1.query();
gp1.query(callBack1);
}
}
function callBack1(gp1){
while(gp1.next()){
var location = gp1.u_address_1;
location += " , "+gp1.u_address_2;
location += " , "+gp1.u_building_name;
g_form.addOption('vs_location', gp1.u_address_1, location);
}
}
}