Insert multiple records.
- 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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:13 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 09:25 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:16 AM
Hi @Miroslav5
If possible can you share your script..
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:20 AM
Hi @Miroslav5
Why not to use transform map it will be better.
Just a suggestion.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates