I have an automated action that triggers on Update and Create. It is intended to be used to prevent duplicate emails being imported into the email contact list. When a duplicate is found I get the error "Record does not exist or has been deleted".
I would like it to just delete that record or cancel importing that record. Is the problem happening because the record has not yet been created? My objective is to just skip over that record and not create it and move on to the next one.
new_value = record.email
existing_records = env['mail.mass_mailing.contact'].search([('email', '=ilike', new_value),('id','!=',record.id)])
if existing_records:
record.unlink()
Some help on this would be greatly appreciated if someone could help me out.
Are there really no experts out there who can help to answer this?