- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 01:18 PM
Hi all,
I was trying to bring all the list of one record to the new record in the same table,Similar to duplicating the record or insert ui action.
But was not able to bring the related lists.
Thanks and Regards,
Shariq
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 02:30 PM
Hi Sharique,
I had a similar requirement and worked on it just yesterday. I needed to have a 'Copy' button that creates an exact copy of the record with the created date and time appended to the name, this should also create copies of the records related list. (same records in related list should show up here too, i.e. copies of them)
If this is exactly the same as you want to do, you could use my UI action script modified to suit your instance.
copyFile();
function copyFile(){
current.u_name = current.u_name + " Copy_[" + gs.nowDateTime() + "]";
var originalID = current.sys_id + '';
var copyID = current.insert() + '';
if(copyID){
var gr = new GlideRecord('u_RelatedFile'); //replace table name with the table name of your related list
gr.addQuery('u_file', originalID); //replace field name with the reference field in your related list that points to the main table
gr.query();
while(gr.next()){
gr.u_file = copyID; //replace field name with the reference field in your related list that points to the main table
gr.insert();
}
}
}
P.S. Please hit like, helpful or Correct for my responses as they apply to you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 07:47 AM
What what is I do not have any field in my reference table which has reference to main table. My main table has reference. Related list table has no field by which I can identify. This is my issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 07:48 AM
Sorry for typos please read "What if I do not have any field in my reference table which has reference to main table. My main table has reference but relatedlist table has no reference. Related list table has no field by which I can identify. This is my issue."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 09:57 AM
If there is no reference to the main table, how is the related list being populated? There has to be some criteria right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2020 03:02 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
‎04-22-2021 01:54 AM
Hi...got any help... facing the same issue... Could you please provide with the script here