- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:21 AM
In one of our workflows, we have a task and then an approval. I need help copying the attachment from the task to the approval so the attachment gets included in the approval email. Can anyone help me with the script?
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:26 AM
It's pretty easy to copy an attachment, you just need the original attachment's table name ('sys_task' in your case) and the sys id for the task (these are the first 2 arguments below).
Then, the next 2 arguments are the table name and sys_id for the record you want to copy to:
new GlideSysAttachment().copy(originalAttachment.table_name, originalAttachment.table_sys_id, destinationTableName, destinationSysId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:25 AM
Hi Mike,
Is the email notification on task table or approval table?
There is an option to include attachments in the email notification settings.
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:36 AM
Approval is on the approval table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:26 AM
It's pretty easy to copy an attachment, you just need the original attachment's table name ('sys_task' in your case) and the sys id for the task (these are the first 2 arguments below).
Then, the next 2 arguments are the table name and sys_id for the record you want to copy to:
new GlideSysAttachment().copy(originalAttachment.table_name, originalAttachment.table_sys_id, destinationTableName, destinationSysId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 05:34 AM
Would I add this to the approval activity in the workflow? I guess where I'm struggling is that the attachment would need to be copied before the approval email is sent.