Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to avoid Duplicate Record Insertion through Transform Map script

Mannam Praveen
Tera Expert

Hello Everyone 

 

I had correlation Display on field case table. i had mark coalesce field false. still if anyone case state is open/progress coming with same Correlation Display then it should avoid Duplicate Record Insertion through Transform Map script. how i can achieve it..?

Below code i am using but it still inserting record in to the Table 

//Check record exists for the given u_id
    var gr_case = new GlideRecord('case');
    gr_case.addQuery('correlation_id', source.getValue('u_id'));
    gr_case.addQuery('state', 'IN', '1,10,18');
    gr_case.query();
    //If there is a existing CASE with OPEN status then do not create NEW case send the existing CASE id
    if (gr_case.next()) {
        response.status_message = "CASE " + gr_case.number + " already exists in SNOW with OPEN state for the given TICKET : " + source.getValue('u_id');
        ignore = true;
    }
0 REPLIES 0