- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:30 AM
Hi All/ @Jaspal Singh
I want to remove duplicate attachment from HR le case when HR service is "XYZ" . In HR case there are 2 HR tasks once 2nd task closed complete same attachment attached in HR life cycle case.
Can someone please help me for that?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:32 AM
@abirakundu23 Did you check if any business rule working on HR Task which on completion copies the attachment from task to case?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:32 AM
@abirakundu23 Did you check if any business rule working on HR Task which on completion copies the attachment from task to case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:36 AM
Hi @Sandeep Rajput ,
From case we want to remove duplicate attachment. How can we do use script for that ?
There was a requirement but in case same attachment twice business raise a concern, we want to remove latest duplicate attachment from case. Please support me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 04:04 AM - edited 01-17-2024 04:19 AM
Hi @Sandeep Rajput / @Jaspal Singh ,
I wrote this below script on HR Life cycle table for before/insert. I want to if "Test HR Task " is closed complete then only it will be work. How can achieve ? Please help me on that, below code is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 04:39 AM - edited 01-17-2024 08:16 AM
Hi All/ @Parag Kanoje / @Danish Bhairag2
Even I tried this one as well as per other article , its not working.
Copy Attachments RITM to TASK & Task to RITM witho... - ServiceNow Community
sys_attachment = remove duplicate attachments(before - insert, update) :
script :
(function executeRule(current, previous /*null when async*/ ) {
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_sys_id', current.table_sys_id);
attach.addQuery('table_name', current.table_name);
attach.addQuery('file_name', current.file_name);
attach.addQuery('content_type', current.content_type);
attach.addQuery('size_bytes', current.size_bytes);
attach.query();
if (attach.next()) {
current.setAbortAction(true);
}
})(current, previous);
Quick support is really appreciate. Any suggestion.