Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Australia Upgrade: Dynamic Filter failing for end users with error

melcock
Mega Guru

I have a Dynamic Filter that we set up to pull a list of Business Units a user is assigned to via group membership that has worked fine through Zurich.  When I began testing the Australia upgrade (version glide-australia-02-11-2026__patch2-hotfix3a-07-01-2026) in our Dev instance, it stopped working for end users and gave the error:

 

Method returned an object of type GlideElementReference which is not allowed in scope rhino.sandbox

 

When I run it as an Admin, it works fine.

 

The script pulls data from sys_user_grmember and then checks each group in turn to see if there is a Business Unit associated with that record. Only one BU can be assigned to a group, and we have groups for each relevant BU.  The table path is: sys_user_grmember -> sys_user_group -> business_unit (via a reference field we added to sys_user_group.

 

The code for the Dynamic Filter:

 

new getMyHistoricalGroups().getGroups();

 

The original script include that works for Admin but not End Users:

 

var getMyHistoricalGroups = Class.create();
getMyHistoricalGroups.prototype = Object.extendsObject(AbstractAjaxProcessor, {

	getGroups:function() {
		var selected = [];
		
		//Get the sys_id of the current user
		var uID = gs.getUserID();     
		
		// Get all active groups where user is a member
		var grmember = new GlideRecord('sys_user_grmember');
		
		// this returns the proper groups in the log but nothing in the Dynamic filter
		var query = 'user='+uID; 
		grmember.addEncodedQuery(query);
		grmember.query();

		while (grmember.next()) {		
			//u_limit_afes_to_sector is a reference to the business_unit table
			gs.log("GroupID = " + grmember.group.sys_id);
			gs.log("AFE Field = " + grmember.group.u_limit_afes_to_sector.sys_id);
			if (grmember.group.u_limit_afes_to_sector && grmember.group.u_limit_afes_to_sector.sys_id) {
				selected.push(grmember.group.u_limit_afes_to_sector.sys_id);
			}
		}
		return selected;
	},

    type: 'getMyHistoricalGroups'
});

 

A couple of notes:  If I replace the "return" value with a hardcoded array of sys_id, it works for the end user.  I've tried all sorts of options, including playing with the ACLs, but no success.  Any thoughts on how to get this working again?

 

Side question:  gs.log and gs.info lines are no longer saving to the system log.  Is this a change for Australia?  Are they going somewhere else?  Losing this as a debugging option is making it a lot harder.  For ease of use, I've removed all of the gs.{option} values from the code above.

 

Thanks!

0 REPLIES 0