Gliderecord in client script

Anirban Roy
Mega Guru

Hi,

Why gliderecord query does not return results while using in client scripts for non-admin users?

e.g. 
var group = g_form.getValue('assignment_group');
var user = g_user.userID;

var ir = new GlideRecord('sys_user_grmember');
ir.addQuery('group', group);
ir.addQuery('user', user);
ir.query();

if(ir.next()){
g_form.setValue('assigned_to', user);
alert(ir.sys_id+'if');
}else{
alert(ir.sys_id+'else');
}

 

  • If code runs with admin user logged/ impersonated, it alerts sys_id with 'if' string.
  • If code runs with a non admin user logged/ impersonated, it alerts 'undefined' with 'else' string.
PS: I know, we should not use do sync calls to server from client unless required, and also gliderecord should not be used in a client script/ or client side scripts. But I am curious to know the reason, that script behaves differently for admins and non-admins.

Regards,

Anirban

1 ACCEPTED SOLUTION

The table glided is on 'sys_user_grmember', however I still tried to test by deactivating the before query BR you mentioned. Did not return result either with non-admin.

View solution in original post

8 REPLIES 8

sachin_namjoshi
Kilo Patron
Kilo Patron

This will be due to read ACL on sys_user_grmember table on your instance.

IT seems that only admin can read records from sys_user_grmember table on your instance.

 

Regards,

Sachin

But gliderecord script does not check acls, right?

The gliderecord stops working/ or does not return result set when called directly from client side in a session where the user does not have sufficient privilege on the queried table.

I am seeking some documentation/ actual reasoning on this.

I agree to this...
It has to be an ALC issue...
Cant verify this now but that's what comes closes to hand. 

dvp
Mega Sage
Mega Sage

The Non admin user might not be a member of assignment group