- 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:09 AM
Looks like GlideRecord is not working. Normal alert is working fine
var gp = new GlideRecord('core_country');
gp.addQuery('name', newValue);
gp.query();
while(gp.next()){
alert(gp.sys_id);
countrycode = gp.iso3166_3;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:15 AM
Hi Surya, Service Portal uses Mobile UI scripts. refer this link for difference between the two https://community.servicenow.com/community/develop/blog/2015/09/21/scripting-for-the-mobile-ui
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:24 AM
Mohammed,
Is there any sample mobile script to get data from data base add populationg the select box options?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:28 AM
You can use GlideAjax for this and pass the options in a JSON object to the client side
http://wiki.servicenow.com/index.php?title=GlideAjax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:29 AM
Can you add some gs.log statements to see what's not getting through?