- 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 07:49 AM
Below is the code . Before while loop alert is working fine and the alert inside while loop is not working
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearOptions('vs_location');
var countrycode;
// Get the country code from country table
var gp = new GlideRecord('core_country');
gp.addQuery('name', newValue);
gp.query();
alert('working');
while(gp.next()){
countrycode = gp.iso3166_3;
alert('test');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:51 AM
On which variable is the onChange client script on and what is the variable type of it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:56 AM
What is the lookup table and lookup value of the variable vs_country. Open the variable dictionary,post the screenshot of it.