Copy attachments from one SCTask to antoher

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 02:18 AM
hi Guys,
how we can copy attachments from one SC Tasks to another SCTasks.
for example: one request having multiple SCTasks, I 'm not going attach the attachments in Request.
I want to attach the attachment in any SCTAsk, that attachment should be copied to antoher tasks..
please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 02:25 AM
GlideSysAttachment.copy('sc_task', 'sys_id_of_source_record', 'sc_task', 'sys_id_of_target_record); //sourceTable, sourceID, targetTable, targetID
So the above uses the GlideSysAttachment (https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/r_SGSA-copy_S_S_S_S
So I would implement this as part of the workflow that you are using, so you don't do it for ALL your sc_tasks. Could also potentially be on insert, but not sure that is the best approach, since you would need to look for any closed tasks, and then copy the attachments over - but there might be multiple. You could sort it by the latest etc, but I would do this as part of a Flow: https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/refer... (and then you can just use the Copy attachment action), or a workflow and you can do the above.
Best regards,
Sebastian Laursen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 02:26 AM
Hi,
Can you please explain the use case for copying the attachments?
They can be made available by showing a related list, or other ways.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2023 09:29 PM
If you really are going through with this, there is also a no-code option, by creating a Flow that does the same as proposed business rules mentioned by others.
Example below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 12:38 PM
Hey OlaN,
Can you expand the Flow Designer for this? This has been asked to do for my organization.
Thanks,