- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2021 10:09 AM
I need to copy an attachment from the Form or RITM to a Catalog Task. From what I have found online, this is what I have tried. However the attachment is not copying over to my Task. I usually work in Workflow Editor but was told this would be a better option. Any help is Appreciated.
Allen
Solved! Go to Solution.
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2021 11:50 AM
I wouldn't say Flow Designer is a better option in this case, especially if you're more familiar with and already running a Workflow on the catalog item. If you must copy attachments, the easiest/best place to do this is in a Business Rule running on the sc_task table after Insert. All you need is this code in the Advanced Script.
(function executeRule(current, previous /*null when async*/) {
GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
})(current, previous);
The reasons for not copying attachments are that it bloats the database with the same attachment record multiple times, and if the attachment is updated on the RITM or SCTASK, the other is not changed. A better option is to create a Defined Related List on the SCTASK form to show the attachments for the parent sc_req_item.
https://docs.servicenow.com/bundle/kingston-platform-user-interface/page/administer/form-administration/task/t_CreateDefinedRelatedLists.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2021 11:50 AM
I wouldn't say Flow Designer is a better option in this case, especially if you're more familiar with and already running a Workflow on the catalog item. If you must copy attachments, the easiest/best place to do this is in a Business Rule running on the sc_task table after Insert. All you need is this code in the Advanced Script.
(function executeRule(current, previous /*null when async*/) {
GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
})(current, previous);
The reasons for not copying attachments are that it bloats the database with the same attachment record multiple times, and if the attachment is updated on the RITM or SCTASK, the other is not changed. A better option is to create a Defined Related List on the SCTASK form to show the attachments for the parent sc_req_item.
https://docs.servicenow.com/bundle/kingston-platform-user-interface/page/administer/form-administration/task/t_CreateDefinedRelatedLists.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 06:28 AM - edited 07-17-2023 06:59 AM
Hi Brad,
As I'm new to ServiceNow, I have a doubt, An image in an RITM has uploaded by some 'X' person while requesting a catalog item however it demonstrates that it has been uploaded by some 'Y' person in an SCTASK related to the same RITM. how can I prevent this to happen?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:46 AM
What we did, to reduce duplication was to add a "flag" on the SCTASK to say that the Parent RITM has an attachment. That way it can be quickly viewed by use of the (i) lookup icon next to the Request Item field on the SCTASK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2021 03:30 PM
Hello
Could you please elaborate on the "add a "flag" on the SCTASK to say that the Parent RITM has an attachment"?