Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to call script include in ACL

Renu9
Tera Contributor

Hi All,

I need assistance in calling script include in the ACL.

Script Include:

var Test1 = Class.create();
Test1.prototype = {
initialize: function() {},

TestFunction: function(gr) {

var appgr;
var grd = new GlideRecord('sysapproval_approver');
grd.addQuery('document_id', current.sys_id); //Fetching for approval record
grd.query();


while (grd.next()) {
appgr = grd.group.assignment_group;
if (gs.getUser().isMemberOf(appgr)) //checking if loggedin user is member of approval gr
{
answer = true;
}
}

if ((gs.getUser().isMemberOf(current.assignment_group.toString())) || (gs.getUser().hasRole('u_confidential')) || (current.opened_by == gs.getUserID())) {
return true;
}
else
{
return false;
}
},

type: 'Test1'
};

 

ACL:

Problem.description (Field level acl-read)

 

How to call the script include in ACL. Kindly guide.

 

1 ACCEPTED SOLUTION

SatyakiBose
Mega Sage

Hi @Renu9 

You can call the script include in a ACL using this syntax:

answer = new ScriptIncludeName().function();

Or if your script include is having just one main function, then simply calling it as:

answer = new ScriptIncludeName();

will also do the job.

View solution in original post

1 REPLY 1

SatyakiBose
Mega Sage

Hi @Renu9 

You can call the script include in a ACL using this syntax:

answer = new ScriptIncludeName().function();

Or if your script include is having just one main function, then simply calling it as:

answer = new ScriptIncludeName();

will also do the job.