Skip to content

Commit d198fed

Browse files
authored
Avoid Duplicate Attachments on incident based on filename (#1013)
* Create AvoidduplicateattachmentsonIncident.js When You attach same file name attachment on Incident , this business runs and aborts attaching the duplicate which has same filename * Create readme.md This BR runs to check duplicate Attachments on Incident table based on attachment filename
1 parent b6b0218 commit d198fed

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
if(current.table_name=="incident") {
3+
4+
var attached = new GlideRecord('sys_attachment');
5+
attached.addQuery('table_name','incident');
6+
attached.addQuery('table_sys_id', current.table_sys_id);
7+
attached.addQuery('file_name',current.file_name);
8+
attached.query();
9+
if(attached.next())
10+
{
11+
12+
gs.addInfoMessage('Attachement already Exists with the Same Name do not upload same attachement');
13+
current.setAbortAction(true);
14+
15+
}
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Type: Business Rule When: OnBefore and On Insert Operation Table:Incident
2+
This BR runs on Insert Operation , IT compares the filename from Sysattachment table and if same attachment with Same file exists on the Incident this BR runs and Abort the Attaching Attachments

0 commit comments

Comments
 (0)