- 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
‎07-14-2022 06:11 AM
Hi
If you have those 1000 incident details in an excel sheet then use 'Import Set' to import data to a table.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 06:19 AM
Hi Sumanth,
I dont have records in excel as well, then from where I can get 1000 records?
Regards,
Amulya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 06:30 AM
Navigate to 'Scripts - Background' from left navigator and write below script
for(var i = 0 ; i < 100 ; i++)
{
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = 'Created from Script';
gr.description = Math.random().toString(36); //it will create random string
gr.insert();
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 06:29 AM
Hi Amulya,
You can write a background script to create a new incident with all the relevant field. Use a for loop to run the script 1000 times.
Regards,
Deepankar Mathur