How to get list collector values and populate in string field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 01:47 AM
Hi Team,
I have to get list collector values and populate in string field in other table how can i achieve it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:15 AM
add your code within the for section
"for section" means
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:23 AM
the code that would write within the for loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:35 AM
I am not clear please help, in edition of above code.
u_select_locations_to_include-My list collecter field name on record producer
u_custom_workforce_report_request- My custom table
u_select_fields_to_be_included_in_the_report-My custom table field where i have to display the selected values in the list collector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 03:30 AM
This code should work but if you're using a client script you'll need to call this from GlideAjax or a reference qualifier depending on how you're implementing this requirement.
var gr = new GlideRecord('u_custom_workforce_report_request');
var list = producer.u_select_locations_to_include.toString();
var array = list.split(',');
for (var i=0; i < array.length; i++) {
gr.u_select_fields_to_be_included_in_the_report += array[i];
}
if you opt to stick it in a business rule running on the u_custom_workforce_report_request table you might have to use
var list = current.variables.u_select_locations_to_include.toString();
lect_locations_to_include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:04 AM
Well list collector stores the sys id , so basically its an advanced form of reference field.
<for server side scripting,else this logic can be used in script include>
store the value in some var arr= current.list_collector.split(',');
then you can use a for loop get all the values
var new_arr= []; //empty array
for(var i=0;i<arr.length; i++){
gliderecord a table;
gr.addQuery('sys_id', arr[i].toString());
...
....
{
new_arr.push(gr.getValue('name'));
}
}
new_arr.join(',');
another gliderecord;
...
gr1.field_name =new_arr;
<updated,if to be used within record producer>
then just first replace current to producer.