- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 12:45 AM
Hi,
Attachment is not getting copied along with other fields when i am clicking on copy change option in case of normal change(change management). Even i have ticked enable copy change feature but still it's not working.
Pls help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 05:37 AM
Hi Nikita,
in the out of the box Copy Change UI action it is calling a script include ChangeUtils
below is the out of the box code
function OnCopyChangeClick() {
function addParam(form, name, val) {
var inp = cel('textarea', form);
inp.name = name;
inp.value = val;
}
var srcSysId = g_form.getUniqueValue(); // this is the source record sys_id
var ga = new GlideAjax('ChangeUtils');
ga.addParam('sysparm_name', 'getChangeQueryParams');
ga.addParam('sysparm_src_sysid', srcSysId);
ga.setWantSessionMessages(true);
ga.getXMLAnswer(function (queryParam) {
if (queryParam) {
var gotoURL = new GlideURL('CopyChangeRelatedLists.do');
gotoURL.setEncode(false);
gotoURL.addToken();
gotoURL.addParam('srcSysID', srcSysId);
gotoURL.addParam('newSysID', '$sys_id'); // this is the new target record sys_id
gotoURL.addParam('sysparm_returned_action', '$action');
var form = cel('form', document.body);
hide(form);
form.method = "POST";
form.action = g_form.getTableName() + ".do";
if (typeof g_ck != 'undefined' && g_ck != "")
addParam(form, 'sysparm_ck', g_ck);
addParam(form, 'sys_id', '-1');
addParam(form, 'sysparm_query', queryParam);
addParam(form, 'sysparm_goto_url', gotoURL.getURL());
form.submit();
}
});
}
just check when new change is created as copy of older; does it fill the parent field with the old change number
if yes then have after insert BR on change request with condition as parent is not empty
GlideSysAttachment.copy('change_request', current.parent, 'change_request', current.sys_id);
what it will do is copy attachments from parent record to new record
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 09:28 AM
Hi Ankur,
Any idea how can I add the related list when copying a change aside from the Affected CI?
Your help will be much appreciated, Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 08:47 PM
Hi,
you want to create record in related list table of affected CI? Didn't get the requirement though
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 07:34 AM
Hi Ankur,
Not the Affected CI, I have other table on my related list that I want to be copied over when copying the change.
Those tables inside the red box is what I want to be copied when copying a change. These are all under related list.
Let me know if you have any idea how to copy those records.
Thank you in advance, your help is much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 02:33 AM
Is this answered?
if my answer helped you, kindly mark it as ✅ Correct & 👍Helpful so that it does not appear in unanswered list & close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 10:10 PM
Hello Ankur,
But property was set to copy the attachment from the original change, then why do we need to make customization? I understand that the code which you explored lacks the copy attachment functionality, should it be brought to the ServiceNow`s attention.
Thanks,
Rahul