- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 10:42 PM
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();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2018 02:13 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 10:51 PM
Hi,
As you want to copy date field, can you please try with gr1.u_notify_on_expiration.getDisplayValue()=gr.u_notify_on_expiration.getDisplayValue();.
Also please use gr1.update(); instead of insert();
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 10:58 PM
Thanks Bhawana,
I just tried that but it didnt work.
---
Actually the field type is List.
It stores multiple email addresses.
Thank again,
Yogesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2018 11:45 PM
If both tables columns are same you can give a try with Export XML and Import XML, it should work.
Steps:
Source table Go to table in list layout -- > right click --> Export XML.
Target table: Go to table in list layout -- > right click --> Import XML.
If not, then use the below script as glide list is an array of values stored in a single field.
var list = gr.u_notify_on_expiration.getDisplayValue(); var array = list.split(","); for (var i=0; i < array.length; i++) { gs.print("Display value is: " + array[i]);
gr1.u_notify_on_expiration=array[i];
gr1.update();
}
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2018 12:05 AM
Hi Bhawna,
When you upload any record by xml then you can upload it to list view of any table(Need not to navigate to exact list view). It will search the table and sys_id. If it not there on target then it will create otherwise it will update the existing.
Hope this helps.
Regards
Ujjawal