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-29-2012 07:55 AM
Tony,
I have a similar requirement to copy the item attachment(s) to a change task that is generated by a catalog item workflow. I already have the attachment copying from the catalog item to the sc_tasks, but am unsure of how to pass these on to a change task that I have generated by the workflow. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 08:02 AM
Hey breinhart,
Just a thought : If you want the attachment of one task to appear in the same page as another task having the same parent, Why don't you create a related list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 08:04 AM
I agree that a related list sounds better. That way you don't have multiple copies of the same file taking up space in your sys_attachment table, and you don't have to worry about cleaning up when you want to remove an attachment.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 08:40 AM
Our solution to this issue was to run a Display business rule on the sc_task table to query the parent RITM record. If it finds an attachment, the script adds a message at the top of the form with a link to the RITM. Thus, the attachment is at most, 2 clicks away (one click to open the RITM, another to view/edit the attachment). If you wanted to get more sophisticated about it you could link to the attachment(s) directly, but the two-click solution seems to work for us.
Business Rule: Links for attachments on RITM
Table: sc_task
When: Display
Order: 100
myFunction();
function myFunction() {
//Check for attachments and add link if there are any
var attachment_link = '';
var rec = new GlideRecord('sc_req_item');
rec.addQuery('sys_id', current.request_item);
rec.query();
if(rec.next()){
if(rec.hasAttachments()){
attachment_link = gs.getProperty('glide.servlet.uri') + rec.getLink();
gs.addErrorMessage('This task\'s Request Item has attachments. CLICK HERE to view the Requested Item record.');
}
}
}
We used an error message instead of an info message because our users liked the higher visibility of the error. This solution avoids multiple copies of the attachment in the sys_attachment table. Not sure if that will meet your specific needs but feel free to give it a try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2012 04:28 PM
Especially the savings on copying attachments. For those that use printAttachments() in your notifications, don't forget to dot-walk back up to the RITM (or Parent) to grab those links for your emails.