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

can you confirm when you validate this business rule with other users then how are you passing the "user_sys_id" in your business rule, any field value have you used to pass that in script? 

 

this script validate if the sysid of the record exist in the sys_user table then it will come inside the if block ,  else it will give you nothing .

 

the user id exists in the sys_user otherwise it would not come with admin user role.

i am sorry i got confused, can you please share the screenshot , in what scenario the above script has not worked . 

because the script which you have shown that should work in all way. either i do the test as an itil user or you do the test as an admin. 

if something not working then there could be some other issue , just guessing 

 

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 !!