Editing a Custom Field under Accounts

I have several custom fields in the Accounts module, of which one is unable to update an entry properly.
The field in question is named Email Address (email1). Most of the accounts have a blank email address. When I enter a value in the Email Address field such as user@user.com, the entry is stored as user@user.com. However when I attempt to update that field a second time to user123@user.com, the original entry remains unchanged. The field simply refuses to allow a second update from a blank entry. This issue started after updating SuiteCRM to version 7.13.2 from 7.12.7. BTW I am logged in as Admin. I’ve tested this issue under another non-Admin user and the same issue persists.
The other custom fields seem to be updating normally when updating them a couple of times.

Is this a bug or something else?
Thanks

email1 is used internally to represent the first of the related email_addresses.

I assume this is what is causing the problems - I advise you to simply use a different field name.

That being the case, I have over 500,000 account records some of which have email addresses using the email1 field name. How can I keep the email addresses already associated with their accounts and change the field to email_address instead? I can’t afford to lose these data records.

Is there a simple way to maintain the email addresses in their respective accounts?

Also wanted to add that this issue happens in the Accounts Detail View screen. Yet if I go into the Edit screen, I can update or completely remove the email address.
Any suggestions on what I could name the new email field?
Thank in advance.

I think you can just rename the field, although you need to be careful doing it, on a test system (or with proper full backups).

You probably need to change the name

  • in the module’s vardefs (followed by QR&R)

  • in the <module>_cstm table in the DB (though possibly the QR&R will offer to do it for you)

  • perhaps in the fields_meta_data table

I would call it something original such as my_email1 instead of email_address

Instead of renaming Email1, I decided to create two new Email Address fields ( AcctEmail1 and ACCT Email2) using Studio. In custom/modules/accounts/metadata/detailviews.php I to added Custom Code per coding below for each new email address.

I created 2 custom email address fields in the Accounts module’s DetailView using the custom code below. Problem is that clicking an email address doesn’t open SuiteCRM’s Emails module but instead wants to open Windows 10 Mail; yet the original builtin Email1 field is clickable and opens the Emails module, allowing the use of custom email templates. How can I get the two custom email addresses to be clickable and open the Emails module within SuiteCRM? Thanks in advance

Custom Code used in Custom\modules\Accounts\metadata\detailviewdefs.php

0 =>
array (
‘name’ => ‘acctemail2_c’,
‘label’ => ‘LBL_ACCTEMAIL2’,
custom Code => <a href="mail to : {$fields .acctemail2_c. value} >{$fields .acctemail2_c .value}',

(I purposely left out single & double quotes in the custom code so I could post this msg) and performed QR&R twice

To post code, enclose it in backticks: `code`

if it’s multi-line, use triple-backticks on separated lines:

```
code
```

(you get nice syntax highlighting with this)

About your question, you’d have to dig into the .tpl files of each field, in order to see how the links are being formed.

You custom fields, which type do they have? I think there is an email field type which should get your fields to use the same tpl’s as the email1 field…

I’m on SuiteCRM v7.13.2 and after checking in Studio, I can’t find an option to create a new custom field as as Data Type email.
Maybe version 8 may have that option but 7 doesn’t appear to have it. Is there any way to create a field type Email or any way to clone the Email1 as ACCTEMail1 and ACCTEMail2?

There have been no changes to this between v7 and v8.

If you can’t find it, I would say it just never was there. Next up is trying to do that through code, specifying type in the vardefs… I don’t know the specifics, sorry, but I would start by trying to get to the definition of an existing field that works, and replicate that in the new custom field.

But it is possible that not even that works; if the links are built with code specific to the views, i.e., if there is no generic mechanism prepared to handle this.