- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 02:58 AM
Hi All,
I have a from on table u_cssc. whatever attachment is added in cssc record, that should be copied in incidents which are in related list of that record.
How can we achive this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 03:20 AM
Hello @Sanket Pawar ,
You need to write a after insert Business rule on sys_attachment table and the condition should be like
"Table name is u_cssc"
script :
In the query i used parent field assuming parent is the field which stores the cssc record on the incident form.If not replace it with the field name which stores the cssc record
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addQuery('parent',current.table_sys_id); // assuming parent is the field which stores u_cssc record
gr.query();
while(gr.next())
{
new GlideSysAttachment.copy("u_cssc", current.table_sys_id, "incident", gr.sys_id);
}
})(current, previous);
Hope this helps
Please accept the solution if it helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 03:01 AM
Hi @Sanket Pawar ,
Refer below solution it will help you.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 05:31 AM
Hi @Sanket Pawar ,
My response will have the solution. Have you tried?
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 03:08 AM
I don't think it's a good practice to copy attachment from one object to another object as you would imagine it will waste your licensed storage. There are several ways to achieve the visibility of the attachment, depending on your requirements.
There is an excellent ASK WHY article from Chuck here which you may rethink this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 03:20 AM
Hello @Sanket Pawar ,
You need to write a after insert Business rule on sys_attachment table and the condition should be like
"Table name is u_cssc"
script :
In the query i used parent field assuming parent is the field which stores the cssc record on the incident form.If not replace it with the field name which stores the cssc record
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addQuery('parent',current.table_sys_id); // assuming parent is the field which stores u_cssc record
gr.query();
while(gr.next())
{
new GlideSysAttachment.copy("u_cssc", current.table_sys_id, "incident", gr.sys_id);
}
})(current, previous);
Hope this helps
Please accept the solution if it helps you
Thanks