Workflow. Send email. Custom module

Hi guys, I’m new in SuiteCRM.
This is agreat community, i have soved out a lot of issues that came acroos the implementation process by the support given in this forum.

Let me describe my situation. I think is a pretty silly question but I cant figure it out.

I have a custom module wich have a date field and an email field (among other fields).

What i want to do is send an email (from a template) to the email adress (that is in email field) when the date reach certain condition.

In the workflow from, i cant find any way to indicate that the adress to where the mail should be send is the one the field.

¿how can I send to this email adress?

Thanks!

PS: I’m running version 7.11.15, Wamp, Windows 10

Hey,

What type of field is the one you’d like to use?

ie: A standard Text Entry field:
image

Or the Email field that the CRM uses?:



If it is the latter, then you should be able to select “Record Email” on the Workflow Actions
image

Selecting this should send to the Email address associated with the record.
Do you see a similar option to this?

Or is it perhaps a standard Text Field that is being used?

Email field is a special type of field that can not be added via studio as yet (sigh) so the field you have actually created is a Varchar (text) field. In order for the Workflow action to trigger and pick up the email, you have to either modify the Code for Workflow actions or try to copy the relationships that the Core emails field has.

Hi John. Is a standard Text Field. The Record Email option isnt available for this workflow. You can see the options in the first screenshot.

Hi cherub-chum. Thanks for your reply. By copy the relationships that the Core emails field has you mean to create a relationship betwen my custom module and Accounts? (i.e)

Thanks for your reply?

Hey,

Thanks for the reply!

There are some guides on how to add the Email functionality to Custom Modules

However, I’m not sure if that’ll fully resolve your issue

It seems that the “Record Email” option appears for certain module types
(Company and Person)
In a function “getEmailableModules()” in aow_utils.php


Out of curiosity, what type of module is your custom module?

I assume it is neither Company or Person, if you cannot see the option?

(I believe that Company and Person are two Custom module types that come with the OOTB Email Functionality built in to the Module Template.)


Off of the top of my head, I can think of some options from here
(Unless Cherub-chum or yourself can think of anything else?):

  • Like cherub-chum said, you could look into making changes to aow_utils, to append your module to the $emailableModules array that is created

  • If your Custom Module doesn’t have much data, you could re-create it as a Customer/Person type (If you feel that is appropriate)

  • Or, you could instead create a Logic Hook, rather than a Workflow?
    A logic hook would allow you to send to the Email address, as you could simply grab the contents of the Text field, and use it as the address

Some links re: Logic Hooks:
https://docs.suitecrm.com/developer/logic-hooks/

https://johndopenotes.wordpress.com/2013/03/26/sugarcrm-send-email-with-attachment-using-sugarphpmailer-class/

https://community.suitecrm.com/t/custom-module-cant-send-emails-on-logic-hook/65728

1 Like

Hi Guys, i’ve been strugglin with this issue all these days, and unfortunably I didn’t find a nice way to solve.
The custom module is a basic type.

  1. I’ve tried to create an emeil field following this link privided by @John, but I get stuck un step 4. Guide.

  2. Follow the steps of this Guide, It did add the email field, but still doesnt appear the “record mail” option on workflows.

  3. Created a Person type custom module. The disadvantage of this solution is that there is plenty of fields that I wont use. Litteraly, the only default field that I use is email. Even required fields are unusefull for me.
    In addition, when I delpoyed the new module, all my logic hooks where deleted, because is on the same package.

Conclusion:
The best solution would be to be able to add the email field to a basic type custom module.
Anyway solution 3 works, but need more tweking on the future to remove all these filds.

Thanks all for your support.

1 Like

Hey,

I agree that it would be handy to have the option of an Email field on the Basic Module template, but I suppose it depends on the intent behind the “Basic” template…

Perhaps it would be something worth raising on the Project’s Github, and it can be marked as a “Suggestion”?

Anyways, thanks for giving things a try, and getting back to us!
Let us know if you’ve got any questions/issues :slight_smile: