Unable to Call script include in filter condition

Ganesh Palve
Tera Expert

PFB Script include

 

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

	ApprovalNotCome : function (){
	var arr =[];
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('roles=approver_user');
gr.query();
while (gr.next()) {
    var gr1 = new GlideRecord('sysapproval_approver');
    gr1.addQuery('approver.name', gr.getValue('name'));
    gr1.query();
    if (!gr1.next()) {
        arr.push(gr.getValue('name'));
    }
}
gs.log("my error - "+arr);
   return arr;
},

    type: 'Test'
};

 

 

and I am calling above script include like below - javascript: new global.Test().ApprovalNotCome();

GaneshPalve_0-1726756122825.png

but not able to get values in filter?? please help here 

Thank in advance

1 ACCEPTED SOLUTION

Hi @Sid_Takali ,

Got the the solution I just made Sandbox enabled to True on script include and then able to see records

GaneshPalve_0-1726761819884.png

 

View solution in original post

7 REPLIES 7

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Ganesh Palve The syntax seems ok, check if your Array returning correct users with approve_user who do not have any approval records. 

Hi @Sid_Takali ,

I tried using background script geting 2 users 

GaneshPalve_0-1726757696066.png

 

Hi @Ganesh Palve try this   javascript: new global.Test().ApprovalNotCome() not sure if it works or not. Without colon 

Hi @Sid_Takali ,

Got the the solution I just made Sandbox enabled to True on script include and then able to see records

GaneshPalve_0-1726761819884.png