.queryNoDomain();

ARG645
Tera Guru

What are the impacts of using queryNoDomain() in an instance where Domain Separation is NOT enabled. Will it have any impacts ? The reason I ask is because, I see a behavior related to this method where it works fine some times, and it doesn't in some cases. 

Sample Script:

var usr = new GlideRecord('sys_user');
usr.addQuery('active', 'true');
usr.addQuery('user_name', userid);
usr.queryNoDomain();

if(usr.next()) {
//further Code goes here
}

Thank you,

Aman Gurram

1 ACCEPTED SOLUTION

It should not really matter, but I would just switch back to "query" instead. 

View solution in original post

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

If domain separation is not enabled, is there any reason you are still using it?


Please mark this response as correct or helpful if it assisted you with your question.

No, there is no specific reason to use it. But I am in a situation where somebody else used this method in their code, and I was given the responsibility to fix it. 

Ok. May be you should try adding some debug statement to identify, in which particular case it fails.

If you have the root cause you will have reason to remove it or keep it.

 

var usr = new GlideRecord('sys_user');
usr.addQuery('active', 'true');
usr.addQuery('user_name', userid);
usr.queryNoDomain();

if(usr.next()) {
gs.info('Success for '+userid);
}
else
{
gs.info('Failed for '+userid);
}

Please mark this response as correct or helpful if it assisted you with your question.

It should not really matter, but I would just switch back to "query" instead.