- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 03:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 05:25 AM
Hello @Ak8977 ,
Instead of copying the attachment, we took the approach of creating a Relationship (sys_relationship.list), and adding the Relationship Tab under the Related Links on REQ/RITM/SCTASK. This ensures visibility to the Attachments regardless which level or Task of a Request you're working on, and that you don't duplicate Attachments.
Here is how we configured the Relationship:
- Application = Global
- Applies to table = Global
- Queries from Table = Attachment (sys_attachment)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 04:09 AM
Hi @Ak8977
Solution is here
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 04:20 AM
@Ak8977 Please create a business rule on sc_task table as follows.
Here is the script.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var attachment = new GlideSysAttachment();
var copiedAttachments = attachment.copy('sc_req_item', current.getValue('request_item'), 'sc_task', current.sys_id);
gs.info('Copied attachments: ' + copiedAttachments);
})(current, previous);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 03:53 AM
The script is working when the user created a new request, but when the user update the record and added new attachment, sctask is not updating the attachment anymore

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 06:58 AM
@Niccolo The business rule runs for insert operation. If you wish to make it available for update too then the script needs to be updated slightly.