7.10 Workflow - How to Send Email from Project Task to Account

Using WorkFlow, how can I send condition-based email (using Email Template) from a Project Task to the Account (email1) associated with the Project?

WorkFlow Project to Account email works.great, but Project Task email only goes to the Assigned User.

THX.

Sometimes you can work around these difficulties by moving the data you need into the other module.

So you could create a custom field in Project Tasks to store the Accounts email.

Whenever the Account email is saved, a workflow would copy it into that field. Then when you need it for the workflow you were asking about, you will have it there, in the correct module, instead of in the module-related-to-the-module-related-to-your-module :slight_smile:

Thank you for your response.

I believe the solution to this is complicated because all Email Addresses reside in a common email_addresses table that are indexed to their respective associated module(s). (e.g. accounts_contact and projects_accounts)

So, both Account and Project can send Emails to the “Account Email” with native WorkFlow which uses the email_addresses index.

Making it work for Project Tasks is more complex:

  1. Using native WorkFlow to copy the Account Email to Project Tasks is not supported (since it is not a field in the base record but is indexed).

  2. If the Account Email Address were copied to Project Tasks, it does not appear that native WorkFlow can use it to send Emails.

Unfortunately, it seems that Custom Code will be needed to permit Project Tasks to send Emails to Account similar to Project.
The good news is this should be possible since the Project Task base record uses the same Project ID value that is used by Project (which is also the key used for the projects-accounts index used for Emails.)

All ideas to make this happen are much appreciated. :side:

Regards

You can use a logic hook, and inside it run any SQL you need to get the filed you want and copy it into the tasks.

What will the logic_hook do?

It seems to me I need to create a relationship for ProjectTasks to use ProjectID in the projects_accounts table Index to find the Account ID that will be used for the Email Address. Next, that Email Address needs to be made available in WorkFlow to be the target for the Email Send.

So basically, Project Tasks needs to behave the same in WorkFlow as Projects pertaining to Email Sends.

I’m reviewing the Projects code. Please let me know any suggestions for the solution. THXS

  • create a custom field in project tasks to hold the email address - just a simple text field, perhaps
  • create an after_save logic_hook on Project tasks, so that whenever it’s updated, you go and fetch the value for the email address
  • to “go and fetch the value” use a direct DB query that can use SQL joins to reach the Account-related-to-the-project-related-to-the-project-task.

Please close this topic in this Forum Category, I’m re-posting under Advanced WorkFlow. THX

There is no “close” on these forums, just “move to different category” or “delete”. but since you already started the other thread, I’ll just leave this one as it is.