- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I need to do this for a customer:
Create a new business rule:
Name: Copy attachment from RITM to case
Table: sc_task
When to run:
When = After
Insert = True
Conditions:
Synced with case is not empty
Script:
The script should use the parent RITM to query the attachments table to see if the RITM has any attachments.
If the RITM has attachments, move them to the CASE record in the Synced with Case field and delete them from the RITM.
I created this business rule, but it's not working. When I open a request and add an attachment, it doesn't appear in the attachment tab after the ticket is submitted. The process works as follows: when you open a request in the business portal, a case is generated, with a Request, RITM, and task linked to the case. I need the attachments added to the call in the portal to be copied to the case, but they are only being copied to the RITM and the Task.
Can someone help me, please?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Maria Lucia da ,
You can copy an attachment to a case in ServiceNow using the Copy Attachment action in Flow Designer or by using the GlideSysAttachment.copy() script in a business rule or UI Action.
also try htis
(function executeRule(current, previous /*null when async*/) {
// Get the parent RITM
var ritmGR = new GlideRecord('sc_req_item');
if (!ritmGR.get(current.table_sys_id))
return;
// Check if RITM is linked to a case
if (ritmGR.u_case_sync) {
// Copy attachment from RITM to Case
GlideSysAttachment.copy(
'sc_req_item',
ritmGR.sys_id,
'sn_customerservice_case',
ritmGR.u_case_sync.toString()
);
gs.info('Attachment copied from RITM ' + ritmGR.number + ' to Case ' + ritmGR.u_case_sync);
}
})(current, previous);
If my response helped you, please mark it as the correct answer and close the thread. This way, others in the community can benefit too.
Regards,
TejasSN_LogicX
ServiceNow Developer | HackaNow Finalist | Community Contributor
📧 tejas.adhalrao11@gmail.com
🔗 LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Maria Lucia da ,
You can copy an attachment to a case in ServiceNow using the Copy Attachment action in Flow Designer or by using the GlideSysAttachment.copy() script in a business rule or UI Action.
also try htis
(function executeRule(current, previous /*null when async*/) {
// Get the parent RITM
var ritmGR = new GlideRecord('sc_req_item');
if (!ritmGR.get(current.table_sys_id))
return;
// Check if RITM is linked to a case
if (ritmGR.u_case_sync) {
// Copy attachment from RITM to Case
GlideSysAttachment.copy(
'sc_req_item',
ritmGR.sys_id,
'sn_customerservice_case',
ritmGR.u_case_sync.toString()
);
gs.info('Attachment copied from RITM ' + ritmGR.number + ' to Case ' + ritmGR.u_case_sync);
}
})(current, previous);
If my response helped you, please mark it as the correct answer and close the thread. This way, others in the community can benefit too.
Regards,
TejasSN_LogicX
ServiceNow Developer | HackaNow Finalist | Community Contributor
📧 tejas.adhalrao11@gmail.com
🔗 LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
if you copy files it will lead to increase in attachment table size
TNT: "Related Attachments" Related List
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader