
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 02:45 AM
Hi all,
Is it possible to take attachments added to a Change_task and put them on the Change record itself? One of our workflow steps is to create a task for creating an estimate, as part of this it requires an attachment and then can be closed. I want that attached estimate to be added to the Change record itself once the task has been closed so that the customer can see it.
Kind Regards,
John
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 06:35 AM
As your requirement is to copy attachment when the task is closed
Create a business rule on change_task with condition as state changes to closed
and use the following script
GlideSysAttachment.copy('change_task', current.sys_id, 'change_request', current.change_request);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 02:53 AM
yes thats possible,
you need to write the after business rule here, to copy the attachment form change task to your change record.
adding one thread here, which has not applied on same table but the logic they have used same way you can do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 03:21 AM
I would suggest creating an async business rule that runs on sys_attachment when table name is change_task and add additional filters for any attachments that should not be copied
then add the script to get the Change Task and copy the attachments
I tested this solution and it works but keep in mind that this will duplicate all attachments from Change Task to Change so if that is not the desired outcome you will want to add to the filter to look for the attachments you want copied.
Thanks,
Brent
If this helps please mark as helpful or correct so that others may benefit from this information as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 04:52 AM
Hi Brent,
I have tried this business rule as you suggest but it does not copy the attachment. The task is created via workflow, then the attachment is added and the task closed. At this point i would like to take the attachment and add to the change itself. Is this something that could be done in a workflow?
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 05:34 AM
Absolutely. Add a script activity after the task and add this code.
// Get the tasks assosiated to this change
var changeTask = new GlideRecord('change_task');
changeTask.addQuery('change_request', current.getUniqueValue());
// filter for your specific Tasks
//changeTask.addQuery('')
changeTask.query()
// Loop through each of the tasks
while (changeTask.next()) {
// copy attatchment from Change Task to Change
GlideSysAttachment.copy("change_task", changeTask.getUniqueValue(), "change_request", current.getUniqueValue());
}
Thanks,
Brent
If this helps please mark as helpful or correct so that others may benefit from this information as well.