Insert multiple records.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:08 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:22 AM
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