- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 02:20 AM
I'm trying to retrieve a query from a report for an ATF test I'm working on:
When I click on the number 80, it takes to the the list within the sys_user table where it contains a Related List condition, and from there I'm able to right click on the end of the filter and select 'Copy query':
However, what I'm wanting to do is use the query when I click on 'Copy query' and apply that within my ATF. i was just wondering if that is possible to do.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 03:40 AM
Hi
(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord('sys_user');
gr.addQuery('active=true^u_employment_type=Physical Access Only^locked_out=false^RLQUERYx_snc_acc_entitle_user_account.user,<1^ENDRLQUERY');
gr.query();
var numUsers = gr.getRowCount();
if (numUsers == 0) {
stepResult.setOutputMessage("There are currently no Physcial Access Only user records that don't have a related account");
return true; // pass the step
} else {
stepResult.setOutputMessage("There are affected Physcial Access Only user records that don't have a related account. They can be found in report 'Physical Access Users with no accounts ACTIVE not Locked out'");
return false; // fail the step
}
})(outputs, steps, stepResult, assertEqual);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 03:24 AM
Hi,
Did you try to change the Assert type?
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 03:40 AM
Hi
(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord('sys_user');
gr.addQuery('active=true^u_employment_type=Physical Access Only^locked_out=false^RLQUERYx_snc_acc_entitle_user_account.user,<1^ENDRLQUERY');
gr.query();
var numUsers = gr.getRowCount();
if (numUsers == 0) {
stepResult.setOutputMessage("There are currently no Physcial Access Only user records that don't have a related account");
return true; // pass the step
} else {
stepResult.setOutputMessage("There are affected Physcial Access Only user records that don't have a related account. They can be found in report 'Physical Access Users with no accounts ACTIVE not Locked out'");
return false; // fail the step
}
})(outputs, steps, stepResult, assertEqual);