Records should not get insert, it should get update only if the Coalesce

Community Alums
Not applicable

Hi Experts!

I have a requirement, there is a string field on the target table called "PO number"  , I have made that field as Coalesce, while doing the bulk upload if the record found it is updating that record, if record not found it is creating a new record with blank detail, we don't want to create or insert a new record, we just want to update the records.

I have tried with below script in on before script it is not working it is still allowing to insert new record.
if(action =="insert")
ignore =true;

 

and I have tried with other script as well where I'm querying the target table and searching for the  record if not found then ignoring the insertion, that is also not working, kindly suggest me a solution for this.

CHAITHANYA13_0-1687962733739.png

Thanks in advance,
Chaithanya

1 ACCEPTED SOLUTION

Harshal Aditya
Mega Sage
Mega Sage

Hi @Community Alums ,

 

Hope you are doing good.

 

Instead of using "ignore = true" in transform map script could you please use the same in run script in transform map record

HarshalAditya_0-1687966660171.png

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

View solution in original post

10 REPLIES 10

Harshal Aditya
Mega Sage
Mega Sage

Hi @Community Alums ,

 

Hope you are doing good.

 

Instead of using "ignore = true" in transform map script could you please use the same in run script in transform map record

HarshalAditya_0-1687966660171.png

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

Community Alums
Not applicable

Hi @Harshal Aditya 

Thanks for the reply

I have tried that as well, still it is not working

It seems that ignore= true; statement is not working

 

Thanks,

  • Chaithanya

Pavankumar_1
Mega Patron

Hi @Community Alums ,

you can try onBefore transform script

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
    if (action == 'insert')
        ignore = true;
})(source, map, log, target);

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Community Alums
Not applicable

Hi @Pavankumar_1 
I have tried this also, still not working
Thanks!