About background script limitations.

Ajay95
Tera Contributor

Hi,

 

I was running a simple background script to get the sys_id of each record in the table. But I am able to get only 50000 sys_id only even though the table has the more than 1 lac records.

 

Can any one tell me is there any limitation that how many records can be fetched in background script at a time?

 

 

Below is the script I am using for reference:

 

var gr = new GlideRecord("sys_user_grmember");

gr.query();

while(gr.next()){

gs.print(gr.sys_id);

1 ACCEPTED SOLUTION

Samaksh Wani
Giga Sage
Giga Sage

Hello @Ajay95 

 

It may happens due to linear search of records, as it is quite time consuming. so it is showing only 50K records,

 

You need to Apply the bg script 2 times :-

 

gr.setLimit(50000); // First 50K records.

gr.chooseWindow(50000, 100000);  // For next 50K Records.

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

View solution in original post

5 REPLIES 5

Hi Samaksh,

 

I have tried this and it is working just need to break the output. Like below

 

var gr = new GlideRecord("syslog");
gr.chooseWindow(1, 50000);
gr.query();

while(gr.next()){

gs.print(gr.sys_id);

}