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

Scheduled report execution ignoring conditions in scoped application

gurushankar
Tera Contributor

var test= false;

var number = new GlideAggregate('table");

number.addEncodedQuery('sys_created_on>=javascript&colon;gs.beginning0fToday^sys_created_on<=javascript&colon;gs.endofToday()');

number. addAggregate ('COUNT");

number.query();

if(number.getAggregate ('COUNT' )== null| | number.getAggregate('COUNT')== 0)

{

test=true;

answer= test;

this script inside condition in scheduled report. It is working in global scope but in its not working in scoped application

1 REPLY 1

Anand Kumar P
Tera Patron

Hi @gurushankar ,

 

There is no restrictions for GlideAggregate in scoped app it will work, check the table in which scope and your running script form same scope. Try below script .

var test= false;
var number = new GlideAggregate('table");
number.addEncodedQuery('sys_created_on>=javascript&colon;gs.beginning0fToday^sys_created_on<=javascript&colon;gs.endofToday()');
number. addAggregate ('COUNT");
number.query();
var count=number.getAggregate ('COUNT' );
if(ncount == null | | count == 0)
test=true;
{
answer= test;

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand