- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 12:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 05:53 AM
Assuming that the duplicate record will be calculated based on Short description, In that case you can use before BR in Incident table.
var shortDesc = current.short_description;
var inc = new GlideRecord('incident');
inc.addQuery('short_description', shortDesc);
inc.query();
if(inc.next()){
gs.addErrorMessage('eg:Incident with same SD already exsit');
current.setAbortAction();
}
If this helps you please mark my answer Helpful and Accepted solution,
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 10:10 PM
Hi @Anusha Gorige ,
This script for calculating duplicate record based on short description and caller.
Use before business rule.
Table: incident and When to run: insert (selected)
Write below script in advanced section:
var gr= new GlideRecord('incident');
gr.addQuery('short_description', current.short_description);
gr.addQuery('caller_id', current.caller_id);
gr.query();
if(gr.next()){
current.setAbortAction(true);
gs.addErrorMessage('you can not create new record as you already have existing one')
}
Mark my answer correct and helpful if helps you.
Thanks,
Nivedita Patil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 05:53 AM
Assuming that the duplicate record will be calculated based on Short description, In that case you can use before BR in Incident table.
var shortDesc = current.short_description;
var inc = new GlideRecord('incident');
inc.addQuery('short_description', shortDesc);
inc.query();
if(inc.next()){
gs.addErrorMessage('eg:Incident with same SD already exsit');
current.setAbortAction();
}
If this helps you please mark my answer Helpful and Accepted solution,
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 10:10 PM
Hi @Anusha Gorige ,
This script for calculating duplicate record based on short description and caller.
Use before business rule.
Table: incident and When to run: insert (selected)
Write below script in advanced section:
var gr= new GlideRecord('incident');
gr.addQuery('short_description', current.short_description);
gr.addQuery('caller_id', current.caller_id);
gr.query();
if(gr.next()){
current.setAbortAction(true);
gs.addErrorMessage('you can not create new record as you already have existing one')
}
Mark my answer correct and helpful if helps you.
Thanks,
Nivedita Patil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2023 02:21 PM - edited ‎10-02-2023 10:50 AM
I see that you've marked the 2 previous answer as being correct, and they will do what you are asking for, but I question the requirement. Do you really, seriously, want to do that?
What exactly is a "duplicate" Incident? Can't really be based just on the Short description. What if someone does have the same issue? Are you going to force your agents to come up with a slightly different Short description in order to save the record ("Wireless mouse problem", "Wireless mouse problem2", "Wireless mouse problem3" [OK, not the best example, but you get it])?
What if I have the same issue with my wireless mouse, but 2 months between the issues? You have no details on the requirement that could help us understand why you are asking for this. You have to be careful of the requirements. So many questions on this one.
Remember, TNT: The Customer is NOT Always Right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2023 09:57 PM
before business rule.
Table: incident and When to run: insert
var gr= new GlideRecord('incident');
gr.addQuery('short_description', current.short_description);
gr.addQuery('caller_id', current.caller_id);
gr.query();
if(gr.hasNext()){ //to check least one record present
current.setAbortAction(true);
gs.addErrorMessage('you can not create new record as you already have existing one')
}
Mark my answer correct and helpful if helps you.
Regards,
Avinash Uskamalla