- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 08:20 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 09:58 AM
This worked for me:
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;
var sysID = gr.insert();
GlideSysAttachment.copy('x_utsll_candidate_candidate_outreach', current.sys_id, 'x_utsll_candidate_candidate_tracking', sysID);
var mySysID = current.update();
current.deleteRecord();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 08:24 AM
Please take a look at below:
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 08:26 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 08:27 AM
Hi there,
Is this also about different instances like your other question? Or is this on the same instance?
If same instance. Should the old records and old attachments be kept or are these removed later? Asking because you could also remap the attachments, in that not needed to copy them.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 08:38 AM
This is a separate question from the other one we are working on together. I need a script that finds the current records attachments and then copies them over to the new record.