Trouble Adding Custom 'Send Email' Action Button to SuiteCRM 8.4.1 Case Module

Hi SuiteCRM Community,

I hope you’re all doing well. I’ve been experiencing an issue with SuiteCRM 8.4.1 for the past few days, and I’m hoping someone can provide some guidance. I’m trying to add a custom action button to the ‘Case’ module that triggers the ‘Send Email’ action while also automatically populating the ‘To’ field with the associated account’s email address. Please refer to the attached screenshot for clarification.

I would greatly appreciate any assistance or insights on how to achieve this. If you could provide a step-by-step guide or sample code to accomplish this task, it would be immensely helpful.

Thank you in advance for your time and support.

Do you know that that feature is already available from the Activities subpanel?

Either tell your users to go there, or if you really want to create the new button, check the code for that existing button, it will have the clues you need.

1 Like

Thank you for your response, pgr. Yes, indeed, the “send email” button is available in the activities sub-panel, and users can get used to it. However, the issue arises with the “To” field not being pre-populated, which can be quite inconvenient when there are multiple accounts with several associated email addresses. Users will have to manually select the desired account and choose from multiple email addresses, which can be time-consuming.

To streamline the process, I would like to have the “To” field automatically populated with the primary (main) email address of the account. To achieve this, I’m considering two options:

1. Adding a Custom “Send Email” Button : I could add a custom “send email” button in cases module and configure it manually to pre-fill the “To” field with the primary email address of the associated account.
2. Modifying the Configuration of the Existing “Send Email” Button: Alternatively, I could try to locate and modify the configuration of the existing “send email” button to make it automatically search for and use the primary email address of the account as the recipient.

I’m open to suggestions on which approach would be more feasible and how to proceed with either option. Your guidance and insights would be greatly appreciated.

I think the current behaviour is (kind of) buggy.

  • when the contact belongs to an account, the email destination uses the account’s email. (To me, it would make more sense, when launching the “compose email” from the contacts subpanel, it should use the contact’s email, because I started it from a row containing a contact…)
  • when the contact does not belong to an account, the email destination appears as a blank

I don’t know the exact way in which the mechanism works, but I know it relies on some of these parts of the URL (I added line-breaks and sorted, to facilitate reading):

https://suite8demo.suiteondemand.com/#/emails/composeView?
account_id=31a0bb84-ca64-88dd-b9b8-6512b9bd09c6&
account_name=Southern%20Realty&
activities_name=Heath%20Ralston&
contact_id=120028fb-ab8c-d3e7-0734-6512ba480db4&
contact_name=Heath%20Ralston&
parent_id=31a0bb84-ca64-88dd-b9b8-6512b9bd09c6&
parent_name=Southern%20Realty&
parent_type=Accounts
relate_id=120028fb-ab8c-d3e7-0734-6512ba480db4&
relate_to=contacts&
return_action=DetailView&
return_id=120028fb-ab8c-d3e7-0734-6512ba480db4&
return_module=Contacts&
return_name=Heath%20Ralston&
return_relationship=Contacts&
target_module=activities&

And it’s likely built here, or some similar place:

https://github.com/salesagility/SuiteCRM-Core/blob/master/core/app/core/src/lib/fields/email/templates/list/email.component.ts