GlideAjax getXML returns null

Henri Muldre
Tera Guru

Hi,

 

We have a record producer's reference variable where you select a user from table [sn_hr_core_profile] (with 0 filter meaning ALL users, even inactive ones are listed). This record producer is in application/scope "Human Resources: Core".

 

That user's info is then auto-filled with:

  1. onChange catalog client script
  2. which also has a GlideAjax to a script include, where we have a GlideRecord query to get the details, then feed it back as return new global.JSON().encode(j_obj).

For users who are active, this works without issues. I added g_form.addInfoMessage to the onChange script and it returns me valid JSON with correct values:

 

var resp = response.responseXML.documentElement.getAttribute("answer");
g_form.addInfoMessage('var resp: ' + resp); //returns null for Inactive users

 

 

However, we also have a need to have the same functionality for users who's [sys_user] record is active=false and locked_out=true.

 

Question:
Is there some hidden built-in functionality that limits script include's GlideRecord('sn_hr_core_profile') to only work for users who are Active? For active users, everything is working well, but for inactive/locked out users, it does not. No custom limitations have been put in place to limit this.

 

 

var user = this.getParameter('usr');
var gr = new GlideRecord('sn_hr_core_profile');
//gr.get(user);
gr.addQuery('sys_id', user);
gr.query();

if (gr.next()) {
    gs.info('gr.user.name: ' + gr.user.name.toString() + '\n' + 'gr.user.title.toString(): ' + gr.user.title.toString()); //returns empty values for Inactive users
}

 

 
When I try to run this as background script, I find no issues. I'm successfully able to get the details logged.
1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi Henri,

There happens to be a Query BR on user table named user query. Did you check that?

View solution in original post

4 REPLIES 4

Jaspal Singh
Mega Patron
Mega Patron

Hi Henri,

There happens to be a Query BR on user table named user query. Did you check that?

Yes, you are correct. There is an OOB before Query BR named "user query", which is limiting inactive users, if you are non-admin user. Thanks JaspalSingh!

Jugmaz
Kilo Sage

Problem seems to be the Business Rule that blocks the access to non admin/user admin roles.

Yes, you are correct. There is an OOB before Query BR named "user query", which is limiting inactive users. Thanks Jake!