how to call script include from module argument for filter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 05:43 AM
i have written one script include to get mapped location . i want to call this script include in module argument. getting below error. please help
MY script include:// ----client callable is true
var getmappedlocation = Class.create();
getmappedlocation.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
initialize: function() {
gs.info('Initialize script include');
},
getmappedlocation:function(){
gs.info('getmappedlocation:');
var result_value = '';
var grecord = new GlideRecord('xyz');
grecord.addQuery('user', gs.getUserName() );
gs.info('getUserName:'+ gs.getUserName());
grecord.query();
while(grecord.next()) {
if (result_value =='' ) {
result_value = grecord.location.toString();
}
else {
result_value += (',' + grecord.location).toString();
}
}
return result_value;
},
type: 'getmappedlocation'
});
calling module arguments :
^location.sys_idINjavascript:new getmappedlocation().getmappedlocation();//with new also tried but getting same error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 05:47 AM
Hello,
Try changing function name to another:
javascript:new getmappedlocation().anotherFunction();
Thanks,
Abhishek
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 05:48 AM
Hi,
You'd want to remove the initialize function from your SI. I would also recommend renaming the function so that it's not the same exact thing as the name for your SI (just a preference). See if those things help, but the correct reference is like you have, javascript: new scriptInclude().function();
Please mark reply as Helpful/Correct. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!