Restrict submit catalog item if short description and Requester is same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 07:45 PM
Hi All,
Users are creating request through emails. The requirement is to restrict to create request if short description and requested for is same. And the existing record is true.
I read some articles and posts but I didnt find the correct solution.
Please help.
Thanks,
Samiksha
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 12:17 AM
Hi @Samiksha2 ,
You can achieve your requirement by writing on before (insert) Br for checking existing open RITMs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 12:48 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 01:04 AM
Hello @Samiksha2 ,
You can try below before insert Business rule to achieve.
(function executeRule(current, previous /*, gs */) {
// Get the short description and requested for values from the current record
var shortDescription = current.short_description;
var requestedFor = current.requested_for;
// you can use addEncodedquery as well
// var encodedQuery = "descriptionLIKE"+shortDescription +"^requested_for="+requestedFor;
// Create a GlideRecord query to check for existing records
var existingRecord = new GlideRecord('incident'); // Change 'incident' to your table name
// existingRecord.addEncodedQuery(encodedQuery );
existingRecord.addQuery('short_description', shortDescription); //
existingRecord.addQuery('requested_for', requestedFor);
existingRecord.addQuery('sys_id', '!=', current.sys_id); // Exclude the current record
existingRecord.query();
if (existingRecord.next()) {
// An existing record with the same short description and requested for exists
gs.addErrorMessage("A similar request already exists."); // for testing purposr only
current.setAbortAction(true);// Abort the record creation/update
}
})(current, previous);
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 04:58 AM - edited 09-22-2023 05:00 AM
Hi @Chetan Mahajan ,
For different short description also requested item is not generating.
Thanks,
Samiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 09:35 AM
Hello @Samiksha2 ,
Please try with encodedQuery I have already mentioned in my Response.
Thanks,
Chetan