- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2018 06:45 AM
The OOB UI Action Copy Change works very well, especially that it includes all related list items. However, I am trying to figure out how to modify it so that, on the newly created Change, a checkbox is set 'true' to indicate that the UI Action was used to create it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2018 07:31 AM
In the Copy Change UI action, add the name of your true/false field to the line "addParam(form, 'sysparm_query', queryParam);" and set it to true. For me this was line 30:
Example:
addParam(form, 'sysparm_query', queryParam + '^u_custom_field_name=true');
Full script:
function OnCopyChangeClick() {
function addParam(form, name, val) {
var inp = cel('textarea', form);
inp.name = name;
inp.value = val;
}
var srcSysId = g_form.getUniqueValue();
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 = [];
gotoUrl.push('srcSysID=' + srcSysId);
gotoUrl.push('newSysID=$sys_id');
gotoUrl.push('sysparm_returned_action=$action');
gotoUrl = 'CopyChangeRelatedLists.do?' + gotoUrl.join('&');
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 + '^u_copied_change=true');
addParam(form, 'sysparm_goto_url', gotoUrl);
form.submit();
}
});
}
I added a UI Policy to set the checkbox as Read Only during my testing as well. Looks like you can use this trick for other fields as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2018 07:50 AM
I don't think the Insert and Stay UI action is available OOB on the Change table.
But yes, I agree - make a copy of the Copy Change UI Action and use that instead of the oob one.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2020 03:01 PM
Hi guys,
I know this is an old post.. This maybe out of the context but just want ask how can I add all the related records when copying a change?
currently only Affected CIs, Impacted Services/CIs, and Change Tasks are able to be copied over to new change.
Any idea how can I achieve this? I tried editing the 'Copy Change' UI Action but I failed, nothing happens.
any suggestions what else should I change to make this work? I'm gonna be honest, I'm not that good when it comes to scripting BUT I'm trying. Maybe you guys can help me with that too. 🙂
Just in case you came across with this question, your help will be much appreciated, Thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2020 12:36 PM
Hi,
Under Change application => Administration => Change properties
In this path have few change related properties are there, it may be helps you to resolve your query please have a look
If my answer helps you please click on helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2020 04:17 AM
Hi guys, I am currently also editing this copy change functionality and I am bit struggeling to find where to edit the state condition to be enable to create copy also from non-active changes. Any idea? Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 02:03 PM
All, before you update the "Copy Change" UI action, be sure you are familiar with the "Change Properties" management page here:
Change - Administration - Change Properties
That might save you a lot of time.