Generate multiple records based on list collector variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2020 01:17 AM
Can someone please assit on this.
I have table newly created called "x_pgpl2_visitor_re_visitor_registration", i have created the new record producer and have used one variable as "list collector"
I have created the workflow and have added the run script to create records based on the value of list collector.
Result:
Example if i fill in variable (list collector) as "ABC", "BCD", "DDD"
It creates 4 records
1. one record containing all the other varibales
2. record two containing "list collector value " ABC on record and rest of the variables remains blank
3.record three containing "list collector value " BCDon record and rest of the variables remains blank
4.record four containing "list collector value " DDD on record and rest of the variables remains blank
Script used:
var listStr = current.variables.Visitor_Name.toString(); //Visitor_Name list collector variable
var list = listStr.split(',');
for (var i = 0; i < list.length; i++) {
var record = new GlideRecord('x_pgpl2_visitor_re_visitor_registration');
record.initialize();
record .request = current.request;
record .visitor_name = list[i]; //name of the table field
record .insert();
}
- Labels:
-
Notifications
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2020 01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2020 01:31 AM
Its newly created table, there are no BR's on this table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2020 01:28 AM
assuming you have selected the same table on record producer if yes then of course it will create 4 record because your record producer has been set on same table which you are doing glide-record .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2020 01:30 AM
yes I have selected the same table. It should create 3 record based on list collector values right, why 4 here!
My main concern is it doesnt capture rest of variables on either of the records except 1.