About background script limitations.

AjayI7527126430
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

Not applicable

Hello @AjayI7527126430 

 

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

Nayan  Dhamane
Kilo Sage

Hello @AjayI7527126430 ,

 

Try creating a scheduled job and return the same output in a log.

 

Hi Nayan 

 

Thanks for the reply.

 

But is it the limitation of background script to return 50k records only at a time.

Hello @AjayI7527126430 ,

Yes as background scripts run on the server it takes time to load and query all the records. Hence the action might be aborted based on it.

 

Not applicable

Hello @AjayI7527126430 

 

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