We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Scripted Query all records irrespective of domain, from domain separated instance

sunitac
Kilo Contributor

How can I Query, via a script, all records irrespective of domain, from domain separated instance

1 ACCEPTED SOLUTION

vab_13
ServiceNow Employee

I think what you are looking for is "queryNoDomain()"



var abc = new GlideRecord('table');


abc.addQuery("field","value");


abc.queryNoDomain();




Will query ignoring the Domain.


View solution in original post

3 REPLIES 3

vab_13
ServiceNow Employee

I think what you are looking for is "queryNoDomain()"



var abc = new GlideRecord('table');


abc.addQuery("field","value");


abc.queryNoDomain();




Will query ignoring the Domain.


Aka Guglielmo
ServiceNow Employee

amazing! thanks man!

divya mishra
Kilo Sage

var rec = new GlideRecord('incident');


rec.queryNoDomain();


while (rec.next()) {


gs.print(rec.number + ' exists');


}


let me know if it helps