- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 06:07 AM
I need 1000 records inserted in my incident table in PDI, how can I get it ?
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 04:15 AM
Hey
You can create run a for loop:
for(var i = 0 ; i < 1000 ; i++){
var gr = new GlideRecord('incident');
gr.newRecord();
gr.caller_id = gs.getUserID();
gr.short_description = "Created by BG script";
gr.description = "Created by BG script - index of records "+ i;
gr.insert();
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 11:15 PM
Hi,
You can use below script to add 1000 records
var shortDesc = ['Email is not working', 'Hardware Issue', 'Software Issue', 'Password Reset', 'Attendance Regularization', 'Forget Id card '];
for(var i=0; i<1000; i++){
var shortDescRandom;
shortDescRandom = shortDesc[Math.floor(Math.random()*shortDesc.length)];
gs.print("shortDescRandom = " + shortDescRandom);
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = shortDescRandom;
gr.update();
}
Thanks
Sarthak