- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:18 AM
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);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:30 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 03:47 AM
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);
}