How to insert 1000 records in incident table

Amulya Pallapo1
Giga Contributor

I need 1000 records inserted in my incident table in PDI, how can I get it ?

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

Hey @Amulya Pallapothula 

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 🙂

 

Best Regards
Aman Kumar

View solution in original post

10 REPLIES 10

Thanks for the reply , could you please share the background script . It will be helpful for me .

Thanks In Advance

Hey @Amulya Pallapothula 

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();
}

Best Regards
Aman Kumar

Yousaf
Giga Sage

Hi Amulya,

In this link you will find the method to retrieve all incident records from external source

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/remote-tables/referenc...

 

Mark Correct or Helpful if it helps.

Thanks,
Yousaf


***Mark Correct or Helpful if it helps.***

Giles Lewis3
Tera Contributor

I have used the Data Generator contribution by John Roberts on the SHARE site. It is old, but it still works.

Aman Kumar S
Kilo Patron

Hey @Amulya Pallapothula 

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 🙂

 

Best Regards
Aman Kumar