- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 02:38 PM
Hi ServiceNow Community!
I am trying to created a GlideRecord query ignoring domain separation using queryNoDomain(), but I get the error, "Submit canceled due to a script error - please contact your System Administrator" when I test the script.
I know the error comes from when queryNoDomain() is called, but I'm stuck on what to do next troubleshooting. Is there a way I can find the code for queryNoDomain? Or is there a way for me to confirm that this method is enabled?
I also was not sure which forum to post this question to (here or DevOps), so if i should remove one of these posts please let me know.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 03:59 PM
As you have Client script so queryNoDomain doesn't work on client side. Also, GlideRecord in client script is not a good practice. You should use GlideAjax in client script and write script include to process server side code and in there you can use queryNoDomain().
Please Refer GlideAjax doc - https://docs.servicenow.com/bundle/orlando-application-development/page/script/ajax/topic/p_AJAX.htm...
Thanks & Regards,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 02:46 PM
queryNoDomain() only works in Domain separated environments. Its code is not available publicly but you can read its documentation here queryNoDomain.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 02:51 PM
I am in a domain separated environment and it does not work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 03:24 PM
Can you show me the sample of code you are using, if possible?
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 03:35 PM
I am trying to get a specific user in a different domain, by using a given email in a variable called email_manager.
function onSubmit() {
g_form.clearMessages();
var domain = new GlideRecord('sys_user');
console.log("TESTING: 1"); // gets logged
domain.queryNoDomain();
console.log("TESTING: 2"); // does not get logged
if (domain.next()) {
var manager = new GlideRecord('sys_user');
manager.addQuery('email', g_form.getValue('email_manager'));
manager.addQuery('active',true);
manager.addDomainQuery(domain);
manager.query();
if (manager.hasNext()) {
return true;
}
else {
alert("Email error. Please check the previous manager's email.");
return false;
}
}
}