SugarCRM, custom fields, and complex objects

LornaJane has a good write-up on using custom fields with SugarCRM.

But I have a client that needs complex fields.  For instance, email_address has the following fields:

+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| id                 | char(36)     | NO   | PRI | NULL    |       |
| email_address      | varchar(255) | NO   | MUL | NULL    |       |
| email_address_caps | varchar(255) | NO   | MUL | NULL    |       |
| invalid_email      | tinyint(1)   | YES  |     | 0       |       |
| opt_out            | tinyint(1)   | YES  |     | 0       |       |
| date_created       | datetime     | YES  |     | NULL    |       |
| date_modified      | datetime     | YES  |     | NULL    |       |
| deleted            | tinyint(1)   | YES  |     | 0       |       |
+--------------------+--------------+------+-----+---------+-------+

How can you, for instance, add an opt_out field to a telephone number?

While email_addresses is it’s own table, other information such as phones and addresses are just fields in the contact (or account or lead, etc.) table.  This is a major flaw in SugarCRM.
It looks like to create an address or phone number that is a “complex object” (like an email address), or to modify the components of an email address, I’ll need to create a custom module.

Does that mean I have to throw away the functionality of the existing contacts module?

Leave a comment