Email address id change when update

Good morning,
when I change the value from aaa@bbb.com to ccc@ddd.com of a contact’s email address, the id of email address change.
The old email address is still with deleted = 0 and not longer linked to the contact.

Why email address id change (create a new email address and not update the exists)?
Is there the possibility to avoid this behavior and on change the value, update the exists email address?

Thank you
B.

I am not sure, but I believe this is by design. An email address is a separate entity in the SuiteCRM database. It is not just a field in a Contact or a Lead, etc.

This helps with several things:

  • having multiple emails per person record
  • having operations focusing on the address itself: most importantly, opt-outs effective across the system, no matter if you have the same person duplicated, or as both a Lead and a converted Contact, etc.

to work around this design (if you careful, especially about the opt-outs), I would just change the address directly in the database email_addresses table. If you need this often, then create a small UI for it.

Thank you for your reply,
I know that email address is a separate entity into SuiteCRM and not a field like phone fields for example, but, what I would expect is that when I change an exists email (from account detail), the operation doesn’t create a new email address and unlink the old one, but mantain the old record and update it with the new value.
Using Api V8, with PATCH operation, it works: change the email value for the exists record.

In my context, I can’t directly access to the database. :slightly_frowning_face:

Not even from PHP? I mean using custom code to run an SQL command.

So should I change standard behavior of SuiteCRM account/contact save procedure (or partially)?
If so, I can’t change the core of this part of application. I need that it will be standard and not custom.

B.

I was thinking you could leave everything as it is now, only add an auxiliary option for these special email changes. But I don’t know, maybe they are very common for you?

You could make it a logic hook that triggers on Save of email records, and does is magic with a direct SQL query.