- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 10:34 PM
Hi Team,
I have to show record producer-list collector selected values in to "description" field on the table. i have written below code on record producer script cell. please correct me if any wrong here. because it is not working as expected
var myList = g_form.getValue('u_include_all_worker_locations_select_co');
var myArray = myList.split(',');
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
// Do what you want to the retrieved record
v_desc += '\nSelected Countries to include :'+ producer.u_include_all_worker_locations_select_co;
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 11:52 PM
Edit :
var myList = producer.u_include_all_worker_locations_select_co.toString();
if(myList !='') {
var myArray = myList.split(',');
var str='';
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
str += 'Selected Countries to include :'+ gr.name ;
}
}
current.v_desc =str;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 10:59 PM
Hi Mihir,
it is returning sys id's.
and if i selected 2 values it is showing 2 sys id's in to 2 lines. please see below screen shot.
My Code:
var myList = producer.u_include_all_worker_locations_select_co.toString();
var myArray = myList.split(',');
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
// Do what you want to the retrieved record
v_desc += '\nSelected Countries to include :'+ producer.u_include_all_worker_locations_select_co;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 11:06 PM
In place of
v_desc += '\nSelected Countries to include :'+ producer.u_include_all_worker_locations_select_co;
line you have to use
v_desc += '\nSelected Countries to include :'+ gr.name;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 11:43 PM
Hi Mihir, This is worked but please help with out creating 3 times and should be created as in same line with comma separated.
var myList = producer.u_include_all_worker_locations_select_co.toString();
var myArray = myList.split(',');
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
v_desc += '\nSelected Countries to include :'+ gr.name;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 11:47 PM
Try this
var myList = producer.u_include_all_worker_locations_select_co.toString();
var myArray = myList.split(',');
var str='';
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
str += 'Selected Countries to include :'+ gr.name ;
}
current.v_desc =str;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2017 11:52 PM
Edit :
var myList = producer.u_include_all_worker_locations_select_co.toString();
if(myList !='') {
var myArray = myList.split(',');
var str='';
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('core_country');
if (gr.get(myArray[i])) {
str += 'Selected Countries to include :'+ gr.name ;
}
}
current.v_desc =str;
}