- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 04:58 PM
Does anyone know how can you prevent an incident from getting submit if the current caller already has an active ticket with the same description?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2024 03:37 AM
Hi @sola2 ,
I tried your probem in my PDI and it works for me please refer below steps
1. Create Before Business rule and insert is checked
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('incident');
gr.addQuery('caller_id',current.caller_id);
gr.addQuery('description',current.description);
gr.query();
if(gr.next())
{
gs.addErrorMessage('Caller is assgined to same incident before. Please check before creating');
current.setAbortAction(true);
}
})(current, previous);
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2024 04:04 AM
Hi @sola2
To achieve this requirement, you need to create before insert business rule. Please refer below snapshots for your reference,
Use below code,
This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2024 06:08 PM
Hi @sola2
Just you need to modify the message within if loop statement
Just paste this script:
gs.addErrorMessage(gr.number+' Already exist with caller '+gr.caller_id.getDisplayValue()+' and Description - '+gr.description);
current.setAbortAction(true);
Best Regards
Seraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 07:27 PM
@sola2 Please create an onBefore business rule on the incident table as follows.
Here is the script.
(function executeRule(current, previous /*null when async*/ ) {
var glideAgg = new GlideAggregate('incident');
glideAgg.addActiveQuery();
glideAgg.addQuery('caller_id',current.caller_id);
glideAgg.addQuery('description',current.description);
glideAgg.addAggregate('COUNT');
glideAgg.query();
if(glideAgg.next()){
var incidentCount = glideAgg.getAggregate('COUNT');
if(incidentCount>0){
gs.addErrorMessage('An active incident with same caller and description already exist');
current.setAbortAction(true);
}
}
})(current, previous);
Please mark the answer helpful and correct if it manages to address your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 10:29 PM
Hi @sola2
You can do this using Before Insert Business Rule
and add below script in scripting section
I am attaching Screenshot for your reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 10:33 PM
Hi @sola2 ,
Why would you do this? Do you have many users creating multiple incidents due to same issue? To base the incident on the description field is not good practice, is a string field content changes if there is just one more capital letter, a period has been removed etc.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 11:45 PM - edited ‎05-03-2024 11:48 PM
Hi @sola2
Just create one business rule on incident table and use the following:
Select trigger condition When- ' before ' and insert checkbox as true
Activate advance checkbox for scripting and
Try this BR script -
(function executeRule(current, previous /*null when async*/) {
var gr=new GlideRecord('incident');
gr.addQuery('caller_id',current.caller_id);
gr.addQuery('description',current.description);
gr.query();
if(gr.next())
{
gs.addErrorMessage('Incident already exist with caller and description');
current.setAbortAction(true);
}
})(current, previous);
Best Regards
Seraj