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

Shruti
Mega Sage
Mega Sage
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.element = 'X';  //replace element
gr.label = a[i];
gr.value=a[i];
gr.insert();
}

Thank you but I need value 1-90 

and for every single one this value I need specific dependent value 

for example:

value = 1, dependent value = 20

value = 2, dependent value = 21

 

that the logic, which I dont know how to write 

Vishal Birajdar
Giga Sage

Hi @Miroslav5 

 

If possible can you share your script..

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Hi @Miroslav5 

 

Why not to use transform map it will be better.

Just a suggestion.

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates