com.glide.script.RhinoEcmaError: "Class" is not defined.

pardhiv
Tera Contributor

I have a script include that is not client callable. This is expected to return members of a group. This throws a error when I check logs . I'm not seeing the Logs I have in script include

 

com.glide.script.RhinoEcmaError: "Class" is not defined.
sys_script_include.622997a597cf1510921e7cc11153af4c.script : Line(1) column(0)
==> 1: var getGroupMembers = Class.create();
2: getGroupMembers.prototype = {
3: initialize: function() {
4: },

 

Reference Qual : reference to User table

 

javascript: new global.getGroupMembers().groupMembers("aa259fe197cf1510921e7cc11153afd3")

 

 

Script Include :

 

 

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

	groupMembers: function (groupName)
	{
		gs.info('PK1---FUNCTION_CALLED');
		gs.info('PK1---FUNCTION_CALLED--PASSED VALUE ---'+groupName);
		var userArray = [];
	var grGrpUsers = new GlideRecord('sys_user_grmember');
		grGrpUsers.addEncodedQuery('user.active=true^group='+groupName);
		grGrpUsers.query();
		while(grGrpUsers.next())
			{
				userArray.push(grGrpUsers.user.toString());
			}
		return 'sys_idIN'+ userArray.join(',');
	},
	
    type: 'getGroupMembers'
};

 

 

 

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Why it is not client callable i believe you will you will have to make it client callable to have it called from reference qualifier please make it client callable and see if the issue persists or not.

 

Please mark my answer as correct based on Impact.

View solution in original post

2 REPLIES 2

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Why it is not client callable i believe you will you will have to make it client callable to have it called from reference qualifier please make it client callable and see if the issue persists or not.

 

Please mark my answer as correct based on Impact.

Tony Chatfield1
Kilo Patron

Hi, if you are trying to call server side functions from client side then I think you would need to use GlideAjax,

I would try mapping/updating your server script-include to a client callable Ajax script.

GlideAjax | ServiceNow Developers

 

Edit:
Perhaps you can share you client script so that the forum can better understand your server script call?