Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how I can avoid insertion of duplicate record in async insert business rule

akkk
Tera Contributor
 
5 REPLIES 5

GlideFather
Tera Patron

Hi @akkk,

 

Without a description, it’s difficult to answer meaningfully.....

 

Is your question more as preemptive approach (you want to actively avoid it) or the duplicates are already being created and you want to stop it?

 

Please provide more details and also the configurations that you did. The easiest way to avoid would be having proper triggering conditions and eventually some checks on the script. It really depends on what you want to achieve and that's not clear.

_____
100 % GlideFather experience and 0 % generative AI

OlaN
Tera Sage

Hi,

If I understand what you're asking, then I'm not sure if this is possible.

Given that do cannot control when an async business rule fires, you cannot know beforehand if a duplicate record exists or not.

Please elaborate on your use case.

Aditya_hublikar
Mega Sage

Hello @akkk ,

 

why are you using async business rule? This requirnment can be  fulfilled by before insert business rule .Its depends on which field you are comparing .

Lets assume you are comparing duplication on short_description:

so you can use before insert business rule 

 

 

var gr = new GlideRecord('incident');
gr.addQuery('short_description', current.short_description);
gr.query();

if (gr.next()) {
    gs.addErrorMessage('Incident with same Short Description already exists');
    current.setAbortAction(true);
}

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya,

Technical Consultant

 

Hello @akkk ,

 

I hope you are doing well . Does my response helps you ? 

 

If my response helps you then mark it as helpful and accept as solution. This will helps  further future queries.

Regards,

Aditya,

Technical Consultant