- 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-05-2024 01:47 PM
Hello @Seraj, thank you for your assistance. Do you know how could we include the ticket number of the already existing ticket with those conditions? so it says: 'INC# already exist with caller and description, please update your current ticket'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2024 05:41 PM - edited 05-05-2024 05:42 PM
Use:
gs.addErrorMessage('Incident ' + gr.number + ' Desc: ' + gr.short_description + ' already exist with caller and description. Please update your current ticket.');
in Seraj's script. or use gr.description instead of gr.short_description in the above if you want that field's value.
- 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-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