Carrying an attachment from one task to another in the same workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2012 07:46 AM
Is there a way to copy an attachment from one task to another in the same workflow? I saw this post: Copying attachments from an SC Item to the coressponding approval record for that item , but I'm hoping I can somehow use the scratchpad to do this. Is that possible? Any suggestions are greatly appreciated! Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2012 08:55 AM
I'm having a difficult time dissecting your requirement here to understand why you may want to use the
. The Packages.com.glide.ui.SysAttachment.copy method should provide everything you need to copy attachments from one task to another.
workflow.scratchpad
Just use a Run Script activity to go pull your two task records and copy attachments.
Packages.com.glide.ui.SysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2012 09:46 AM
Tony,
Thanks for the feedback. What you're suggesting is what I'm looking for.
I'm just not sure what goes where within this script. The workflow is on the sc_req_item table and the tasks are on the sc_task table, so do I have the first part set up right? (See below) Where do I get the sys_ids?
Packages.com.glide.ui.SysAttachment.copy('sc_req_item', 'sys_id', 'sc_task', 'sys_id');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2012 10:19 AM
The RITM is simple,
, but the task is more difficult. Depends on when the activity occurs in the workflow. You may have to run a GlideRecord query to go fetch the catalog task(s) to which you want to copy the attachments.
current.sys_id
Is this better suited to be a business rule to always copy attachments from sc_req_item to sc_task?
If so, it would look like:
Name: Copy request item attachments
Table: sc_task
When: Async
Insert: true
Script:
Packages.com.glide.ui.SysAttachment.copy('sc_req_item', current.request_item.sys_id, 'sc_task', current.sys_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2013 07:53 AM
Hi Tony,
It's been over a year since I originally posted this question. The issue has come up again and I need to copy an attachment from an item to a task. I tried your script, but it didn't work. I also trying querying the item table for the associated tasks, but that didn't work. I'm using Berlin 5 Hotfix 2.