UI Action that copies attachments from one record to another

JJG
Kilo Guru

Hello, 

I have a UI action that creates a new record in a new table, it then copies all of the old info and inputs it into the new record. However, I would like the attachments to transfer as well. How can I achieve this? 

Here is what I have so far:

var gr = new GlideRecord('x_utsll_candidate_candidate_tracking');

gr.first_name = current.first_name;
gr.email_address = current.email_address;
gr.last_name = current.last_name;

gr.insert();

 

How can I also transfer the attachments?