Workflow to send mail to reports_to of assigned_user_id?

Goodmorning,
I create a workflow for mettings module and I would like (under some conditions) send an email to a reports_to_id user for the assigned_user_id of meeting.
How can I make this?

example:
U1 has reports_to_id = U2

when U1 create a new meeting, I would like to send email to U2

Thank you,
B.

Logic hooks would be a better solution…

Regarding the Workflows, I am assuming you already looked for this in the available options but you don’t find it there…

If the problem is that you have a reports_to_id field, but not an email field, try to work around this with a second workflow, and an auxiliary field. Sometimes this solves problems.

  • For example: when adding a relationship between meeting and user (which happens during creation, I suppose), copy the user’s email into that field
  • then when you need the email, it’s there for you

This is just a general idea, sometimes you can get it to work, other times you get stuck and it won’t function. Try it, and good luck!

Correct: this field there isn’t amongst the options :sob:

If I put the email address into a text field, I can’t find into the options to send.

But, if I create a user field related, (not showing in the form) and in before_save for new record I’ll populate it with user ( reports_to_id) maybe I can see it in the options.

It is similar your solution but the difference is in the type of field and the value.

I try and then I tell you if it is ok.
B.

1 Like

At the moment, I create the custom field related to user module, and it works, the field will display amongst the options available.
later, I’ll create che logic hook for before save.

1 Like

ok @pgr, I’ve done.
This is my solution:
I added a custom field into meetings module. the type of field is relate towards User module.
then, I create a custom logic hook, before save.
The logic hook consists in a db query for table users that retrieve reports_to_id value of the $bean->assigned_user_id user; then assigned the value to my custom field.

So, in workflow when I choose send mail action, in the options for “to”(but also for cc and bcc) I can find my custom field.

2 Likes