How to add email field to custom Module?

Hi Guys,

i think this question has been here along time ago, i saw a post about it, and it’s not working as expected.

https://web.archive.org/web/20160324015137/http://developer.sugarcrm.com/2011/08/08/howto-add-an-email-address-widget-to-any-module/

i followed this tutorial, the email field works fine, but i am not able to save the email in the record neither retrive it from the database.

I could really appreciate some help :slight_smile:

Samer Kaskas

No idea but you could check log files to check if you have any errors. Also, make sure you have correct permissions and ownership to folders and files.

@rsp thanks, i checked the log files and also i have the correct promissions. But there is something, when i try quick repair after pasting the code in the bean file modules/<module_name>/<module_name>.php , it gets stuck on building relationships.

So i did it in custom/modules/<module_name>/<module_name>.php and i get no error, and quick reparis works as well, but still can’t save the email.

Is your custom module in legacy mode? No idea why it is not working.

Maybe I’m not understanding, are you just trying to add an email field much like exists in “contacts” module?

If so, just start with a “person” template for your custom module and it automatically has the email field, no custom coding required.

@pstevens yeah exactly, it was a mistake that i didn’t start with a “person” template, but now i have more than 100 fields in this module, and it would be really hard to start over with a new template.

That’s a tough call. I would almost consider starting a new “person” module and just copying over the vardefs and do an R&R, problem solved. Then I’d be sure it was working as intended without having to hack the email field. Email has always been a can of worms every time I touch it. There are so many moving parts and it’s way more complicated than you expect once you get into it.

Is this a new module or is it already populated with a bunch of data?

In case you want to try here my instructions for copying fields from one module to another.

how_to_copy_custom_lead_fields_to_contacts.zip (67.1 KB)

1 Like