Avoid duplicate incidents , requests , problems

servicenowsnow
Mega Expert

Hi all,

kindly help me to avoid the duplicate incidents , requests , problems ...either manually or through integration .

we had   options like Unique button and colease make true in transform maps .  

Kindly provide other alternate way ( business rule) to avoid duplicate records.

i have tried many , but no luck , kindly help on this.

4 REPLIES 4

Khozema Attar1
Tera Guru

Hi,



If you are performing integration with any third party and you want that when an incident gets created in third party it should be created in SNOW, then transform maps provides a good solution for it.



In order to avoid duplicacy , you can use coalesce on incident number field, which will prevent duplicate incidents from being created.



Thanks


harishdasari
Tera Guru

Hi,



On Incident table create On-Before Business Rule for incident table



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.


    var gr = new GlideRecord('incident');


    gr.addQuery('active', true);


    gr.addQuery('sys_id', '!=', current.sys_id);


    gr.query();


    if(gr.next()) {


          gs.addErrorMessage('Incident Already Exist');


          current.setAbortAction(true);


    }


}



Hope this is Helpful.


Thanks


Karthik Reddy T
Kilo Sage

Hello Snow,



You can make that field property Unique as true and try.




find_real_file.png


Karthik Reddy T.
ServiceNow Commnunity MVP -2018 class.

vinothkumar
Tera Guru

Hi Snow,



We also faced the same issue and Servicenow suggested us to create a before insert business rule on task table.



var curNum = current.number + '';



if(curNum) {



  var recordClass = current.getRecordClassName();


  var gr = new GlideRecord(recordClass);


  gr.addQuery('number', curNum);


  gr.query();



  if(gr.getRowCount() > 0) {


    var newNum = getNextObjNumberPadded();


    gs.addInfoMessage("The number " + current.number + " was already used by another " +


    recordClass + ". The " + recordClass + " number has been changed to " + newNum);


    current.number = newNum;


  }


}