Gday all
Longtime Matrix user returning after a few years break…
A site I'm developing for an organisation with 10 staff members needs a form where people can select the staff member from a drop-down list, type a message, then click "send" to email that message to that person. (i.e. a way to give direct access to staff without publishing their email addresses).
I thought "the mighty matrix can surely do that!"
But now I can't figure out how. Custom form was my first thought, but I can't find a way to offer a select box of the staff members and make the selected staff member the recipient. (Unless I set up a select question with 10 options, then put in 10 different selective email rules, etc etc… yuck).
Email trigger was my next thought, but can't find a way to get the email content from the POST
Surely somebody has solved this before?
Tom
I also have a tendency to overcomplicate things when it comes to forms 
Setup a select list (as you probably were going to), making sure the email addresses are the values. On the "Email Options" screen of the Form Contents asset, set the "Recipient Email Format" to %response_X_qY%, where X is the asset id of the Form Contents, and Y is the question number that has the email address.
It's confusing because there are so many options in the interface, but the one you were looking for isn't in the interface – it needs a keyword.
Let me know if that works, because I don't have the time to test it right now.
I would just create an asset listing which would list your users and their email addresses as a select, then nest that into your custom form in place of that question. Make sure to give it the same ID as the question you are replacing.
I do this all the time with Asset Builders to make create locations be in A-Z order.
Although, this still does not solve the problem of not making those email addresses public. Are you sure that you can't pass the ID of a user asset to the send email trigger?
There is a much simpler way than this:
Set up the recipient email on the email options screen:
in the body of your email use the keyword %response_[id of form contents]_q[id of the question which is you comment you want to send]%
then on the selective emails screen:
1- add a new rule click commit
2- in the Add New Rule part section, Apply to Rule Field choose the question that applies to your users, click commit
3- in the Add New Rule part section, Add Rule Part field choose Selection Comparison click commit
4- in the Active Rule section, Option field choose your first User
5- in the Email Options for Active Rule section:
a- Email Settings - When ALL rule parts are matched
b- send a Recipient Email to
c- fill in the Users email address in the box click commit
The Current Selective Email Rules section should now show an active role for the user being selected
Repeat steps 1-5 for each of your users
Dave
Thanks everyone for the ideas.
Daniel - I want to keep the email addresses off the frontend altogether
nnhubbard - nice nested asset listing idea. The problem with using the send-email trigger was not with setting the recipient assetid, but with setting the email body content - it seems to have to be fixed (with global keywords, which don't help me).
Dave - thanks for the solution that keeps the email addresses off the frontend, but I can see a solution that requires 5 steps per employee becoming a maintenance issue…
Any other thoughts? I really want custom form to look at a question value for the asset id of the recipient user, but it doesn't seem to offer that.
Tom
Wait, maybe global keywords can help me - I see from Daniel's helpful list on his blog that %globals_post_X% is now available (wasn't back in my day). I'll see if that works with the trigger. (Though the form seems like it ought to have been the right solution).
It may be five steps but they are very quick to implement
Dave