custom multipart form field like email address..?

For Custom Module multipart form field like email address........?

Parents Reply Children
  • The way Email addresses work in Sugar is by linking the module with email_addresses table using a join table called email_address_bean_rel. - And by this design you can only use one email field per module.

    There are simple alternatives like creating new text field or text area for additional "Email" types. 

    But - if you really want to replicate the email functionality, one possible solution(without a join table) is to store the emails as a comma separated value in the backend, but in the UI, display it like the Email field, by creating a custom Email Field, which extends the original Email field. Here is a general approach: Eg:

    1. Extend the Email field from clients/base/fields/email and create a new field type in custom folder: custom/clients/base/fields/custom_email

    2. Extend the format and unformat functions in the field.js to convert comma separated values into an array and vice versa.

    3. In your record.php, you can define the field "type" as your "custom_email" so that it uses your new field to display.

    Example of format/unformat functions: https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Cookbook/Creating_Custom_Fields/

    Unfortunately, I don't think there is any easy way to achieve this without significant coding, unless community experts feel otherwise.