Custom Email Field Not Opening Email Module

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 default 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? 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}',
Purposely left out ’ and " in the cust code so I could post this msg
Also performed QR&R twice

Answered here

I make the change and after a QR&R, when clicking on an account name, the result is a blank screen with the top menu options available (Accounts, Sales. Marketing, Support, Activities, Collaboration, Accounts & All).

I’ve attached a copy of the 3 PHP files instead of copying the code - this is the coding that opens Windows 10 Mail instead of the Email module’s Composed Email View.

It’s possible that the code you provided didn’t appear properly as well.

Code you provided appeared as:

‘customCode’ => ‘{$fields.acctemail2_c.value}’,

Is there any other php file that needs to also be updated aside from detailsviewdef.php?
detail edit and listviewdefs .zip (4.4 KB)

I edited the post above to show all the code properly.

Tried the updated code though it doesn’t open the popup window “Compose EMail” with options to:
select an email template
Related To selection (ie Accounts) with a bxo to the right to select the actual account
From dropdown list to select the from email address (ie user’s local email account)
To box
CC & BCC text boxes
Subject textbox

Instead it replaced the Account info screen with a screen that shows:
Related to dropdown box with a box to right to select the account
followed by Save and Cancel buttons.

I’d like to click on the email link and have a popup “Compose Email” windows which leaves the original Account Details screen in the background.

When placing the cursor over the system’s original email1 field, it displays mailto: followed by the email address
When placing the cursor over the newly coded link, it displays “{email address}” and replaces the Details View screen with the screen listed above.

I notice the code provided by @Zxcvvbk links to an Edit view in the Emails module. But there is a specific view for Compose called (appropriately) ComposeView.

Well, we’re almost there. The custom code now replaces the DetailView screen with the Compose Email screen with the ability to select a template. Problem is that it doesn’t populate the Related To: field {should be ‘Accounts’} and the Account from which an email is to be sent. It also doesn’t populate the To: {email address field}. If I cancel from the Compose Email screen, I get the following error even though I clearly have access to that Account:
Error retrieving record. This record may be deleted or you may not be authorized to view it.

The text field ACCTEMAIL1 contains an email address which is clickable.
What I’d like is when clicking on the field Email1 entry that contains an email address, the Account Detail screen remains in the background and a popup windows “Compose Email” appears in the foreground as follows:
Email Template: {is blank from which I can select the Email Template to use}
Related To field shows “Account” with a Empty text box to select the Account
To: {email address clicked in the Account Detail screen}

So my question is how can I accomplish clicking on the AcctEmail1 email address that pops up a Compose Email screen in the foreground with the populated To: email address identical to the process when clicking on the email address in the Email1 entry?

My coding for AcctEmail1 is as presently:

      array (
        'name' => 'acctemail1_c',
        'label' => 'LBL_ACCTEMAIL1',
		'studio' => 'false',
		'link' => true,
		'customCode' => '<a href="index.php?module=Emails&action=composeview&return_module=Accounts&return_action=DetailView&parent_id={$}&type=primary&to_addrs={$fields.acctemail1_c.value}">{$fields.acctemail1_c.value}</a>',

BTW I have tried removing the ‘studio’=>‘false’, statement which made no difference.

I went to accounts, opened browser dev tools, network tab, and clicked “compose email” in the activities subpanel. This is the URL it’s building:

Try to emulate those same arguments in your URL.

I tried your code as per below but instead the email address showed up as a blank entry that was clickable but nothing happened. I could double click the field to edit & it had the email address.

‘customCode’ => ‘<a href=“mailto:?module=Emails&action=ComposeView&in_popup=1&targetModule=Accounts&{$fields.email_address_alt_c.value}”&relatedModule=Accounts&relatedId_&{$fields.email_address_alt_c.value} ’,

I don’t know, maybe some detail is missing. I would try it first with a static URL, without any variables, just directly use static ids, until you can get it working. Then, after that problem is solved, you can try solving the next problem, which is the generation of the dynamic URL.