- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 04:56 AM
Can we write GlideSysAttachment.copy in business rule which does not runs on sys_attachment table?.. Or it can be only written on sys_attachment table?.
I have been trying to write it on sc_req_item table.. but it does not copy the attachment!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 05:11 AM
Here is an example, copying attachments from one incident record to another.
var sourceSysID = '9c573169c611228700193229fff72400';
var targetSysID = '9d385017c611228701d22104cc95c371';
var copyAtt = new GlideSysAttachment();
copyAtt.copy('incident',sourceSysID, 'incident',targetSysID);
If it was in a a br and I want to copy from lets say to current incident record to the record in the parent incident field it could look like this:
var copyAtt = new GlideSysAttachment();
copyAtt.copy('incident',current.getUniqueValue(), 'incident',current.getValue('parent_incident'));
And make this a async BR for performance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2023 03:22 AM
This can be a tricky one. Since somehow you need to figure out how to lookup if the data already has been copied or not and validate that. For attachments it pretty straightforward since you can lookup in the sys_attachment table and see if there already is a attachment with the same name attached to the ticket. Worknotes are harder, since you need to take it account that someone might have written something after "your" comment even it's not a big chance. What also happen if someone removes an attachment, should it be removed on all the other tickets as well?
It would be pretty easy to have it on the parent/child show all related attachments with the need of copy it. Work notes might be tricker and I can't straight out come up with a good solution besides having people only using the parent record for the work notes/comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
@Goran WitchDoc
Very useful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 11:53 PM
@Goran WitchDoc How can we use this method for the catalog item? like catalog client script or in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2022 11:43 AM
Well, this is server-side, so it shouldn't be any issues with having it in a script include. It all depends on what your intentions are with the functionality if that is a good place to put it there. Or if you are triggering a flow by the catalog item, you might just do it in the flow instead.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2022 11:45 PM