How do i Call a script include from Module Arguments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 02:51 PM
Hi,
I have a requirement where, when a user clicks on a module it should call the below script include and it should set the filters on the teble related to the module according to the script.
THIS SCRIPT IS MARKED CLIENT CALLABLE
var ModuleArg = Class.create();
ModuleArg.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
ModuleTesting: function() {
var abc = new GlideRecord('u_test');
abc.query();
while(abc.next())
{
var xyz = "u_field1=option1"; // field1 and field2 are the fields on the table linked to the module on which the user clicks
var pqr = "u_field2=option2";
var x = abc.u_test_field1; // u_test_field1 and u_test_field2 are the fields referring to groups, on the table - u_test, in which the user should be a member of
var y = abc.u_test_field2;
var user = gs.getUser();
if(user.isMemberOf(x))
{
gs.log("success1");
return xyz;
}
elseif(user.isMemberOf(y))
{
gs.log("success2");
return pqr;
}
}
},
type: 'ModuleArg'
});
THE ABOVE SCRIPT IS WORKING FINE (tested it in background scripts). THE ONLY ISSUE IS WITH CALLING THE ABOVE SCRIPT FROM THE ARGUMENTS FIELD IN MODULE.
Argument section for the Module:
Arguments tried:
javascript:new ModuleArg.ModuleTesting()
javascript:ModuleArg.ModuleTesting()
javascript:new ModuleArg()
javascript: ModuleTesting()
What would be the changes that i have to do in order to call the script include?.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 11:34 PM
Hi VT,
Can you please let me know the requirement that you are trying to achieve with a example. So I can see what is the best way to do this.
Regards
Param