Insert multiple records.

Miroslav5
Tera Contributor

Hello,

I need to create 90 records on sys_choice table with specific label and valu from 1000 -1090, please can you help me? Iam doing something bad, my script doesnt work. 

Thanks guys!

5 REPLIES 5

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can use below script 

var values= "A, B, C, D, E"; //replace array values

var a= values.split(",");
for(var i=0;i<a.length;i++){
var gr = new GlideRecord('sys_choice');
gr.initialize();
gr.name='table name of your choice field';
gr.language='en';//if it is english
gr.element = 'X';  //replace choice field name
gr.label = a[i];
gr.value=a[i];
gr.insert();
}

Thanks and Regards,

Saurabh Gupta