The CreatorCon Call for Content is officially open! Get started here.

how to call script include from module argument for filter

Prashant More1
Kilo Contributor

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

find_real_file.pngMY 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

find_real_file.png

2 REPLIES 2

AbhishekGardade
Giga Sage

Hello,

Try changing function name to another:

javascript:new getmappedlocation().anotherFunction();

Thanks,

Abhishek

Thank you,
Abhishek Gardade

Allen Andreas
Administrator
Administrator

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!