How to copy List field from one table to another.

cc11
Tera Contributor

Hi,

I am running the query below to copy date from source table into target table.

All columns are getting copied except the List field.

Looking for help,

var gr = new GlideRecord('u_source_table');
gr.addNotNullQuery('u_format');
gr.setLimit(3);
gr.query();

while(gr.next()){
var gr1 = new GlideRecord('x_target_table'); 
gr1.initialize();
gr1.name=gr.u_name;
gr1.u_notify_on_expiration=gr.u_notify_on_expiration; // LIST FIELD NOT COPYING
gr1.server=gr.u_server_name;
gr1.insert();
}
1 ACCEPTED SOLUTION

Shweta KHAJAPUR
Tera Guru

Hi,

Your code is working fine for me. Check field name once. Add some info/log messages just after while as below,

gs.addInfoMessage(gr.u_notify_on_expiration);

OR

gs.print(gr.u_notify_on_expiration);

 

Regards,

Shweta K

View solution in original post

11 REPLIES 11

Monika2
Giga Guru

Hello,

The code you have provided is working at my end for glide_list as well.

find_real_file.png

find_real_file.png

var gr = new GlideRecord('u_test2');
gr.addNotNullQuery('u_sum');
gr.setLimit(3);
gr.query();

while(gr.next()){
var gr1 = new GlideRecord('u_test3');
gr1.initialize();
gr1.u_value = gr.u_value;
gr1.u_test_list = gr.u_test_list;
gr1.insert();
}

Please check if you have given the correct field names.

 

Regards,

Monika

Surabhi5
Kilo Contributor

Hi Monika,

I have a similar requirement and would really need some guidance on how i can achieve this.

I dont seem to be able to work out this one.

 

Regards,

Surabhi