Cannot get a sys_user record

Yusuf5
Tera Expert

Hi Guys,

I am trying to get a sys_user record.

When I request the user record from admin it works.

When I try to do the same thing it doesn't get.

I am running GlideRecord from BusinessRule.

Any help is appreciated.

Regards

Yusuf

 

1 ACCEPTED SOLUTION

Snowdev3
Giga Expert

Hello,

 

Kindly, check the read access controls for the "sys_user" table. As per my understanding you are trying to say the user record is accessible from an admin account but not for any other role.

 Verify the below access control on user table and Check if required roles are added to these access control :

  • Read. none 
  • Read .* 

If this is appropriate , try to debug your business rule by adding log statements. 

You can also try to use impersonation script to debug in background script :

session.onlineImpersonate("skarke1990@gmail.com");
var gr = new GlideRecord('sys_user');
gr.get(usersysid);
gr.query();
if(gr.next()){
    gs.print('debug statement'+gr.email);
}
session.onlineUnimpersonate();

Debug : Impersonation script

Please mark helpful if its useful information for you 

Cheers !!

 

View solution in original post

14 REPLIES 14

No getRefRecord(),

var user = new GlideRecord("sys_user");
if (user.get("user_sys_id")) {

      //If I try with a user with admin role it comes here otherwise it doesn't
      user.email = "new email address";
      user.update();
}

 

 

Rahul Kumar17
Tera Guru

hi,

1>check the user is inactive

2>yes user is inactive then Activate the user

3>check ur script is correct or not

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

Yes user is inactive, but works from admin role account

what exactly have you written?

if any script you have used then paste it here so we can try to check that 

It is a pretty straitforward code,

var user = new GlideRecord("sys_user");
if (user.get("user_sys_id")) {

      //If I try with a user with admin role it comes here otherwise it doesn't
      user.email = "new email address";
      user.update();
}