- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2015 03:11 PM
Hi,
I tested the following script on browsers (changed gs.print to console.log), it was okay. However, it returned error on ServiceNow when I tried to run it in Background Script. It seems that Array Map function is not working. Anyone knows why?
The Script:
var keywords = ['A', 'B', 'C'];
var parts_name = keywords.map(function (item) {return item + '; ';});
gs.print(parts_name[0], parts_name[1], parts_name[2]);
The error returned:
Javascript compiler exception: The undefined value has no properties. (<refname>; line 3) in:
var keywords = ['A', 'B', 'C'];
var parts_name = keywords.map(function (item) {return item + '; ';});
gs.print(parts_name[0], parts_name[1], parts_name[2]);
Thank you very much,
Eric Poon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2015 03:25 PM
Hello Eric,
On this link you can see that Map Array is supported by most browsers, however, it is not supported by IE on versions prior to 9. I have found that ServiceNow offers similar support for javascript as IE 8 (Maybe 7), there are multiple native methods that you will not be able to use in ServiceNow and you will need to find a workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2015 03:25 PM
Hello Eric,
On this link you can see that Map Array is supported by most browsers, however, it is not supported by IE on versions prior to 9. I have found that ServiceNow offers similar support for javascript as IE 8 (Maybe 7), there are multiple native methods that you will not be able to use in ServiceNow and you will need to find a workaround.