Try this

var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery('active=true^RLQUERYsc_task.request_item,=00^active=true^ENDRLQUERY');
ritm.query();
gs.print(ritm.getRowCount());
while(ritm.next()){
	gs.print(ritm.number);
}

sudhir041
Tera Contributor

can i not use glide aggregate?

What are you trying to accomplish exactly? What's the end goal once you have the aggregate count?

sudhir041
Tera Contributor

I need the RITM so instead of GlideRecord i wanted to go ahead with GlideAggregate.

The code I provided will give you that and also let you access the RITM details.

 

var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery('active=true^RLQUERYsc_task.request_item,=00^active=true^ENDRLQUERY');
ritm.query();
gs.print(ritm.getRowCount());
while(ritm.next()){
	gs.print(ritm.number);
}