Hopefully someone an help with this. I am trying to send a specific email via the gMail pack to each person in the People table based on one or more of their interests. In other words If Person A is interested in Goats and Cats and Person B is just interested in Cats, then clicking the Send Email button on the Cats related row in the Newsletter table will send content to Persons A and B but sending an email related to Goats will only send to Person A.
I’ve been trying various variations of the code below in the button but I can’t get anything to work:
I can’t view the doc, but are the interests their own table?
If not, I would recommend making them a table (so that in the People table, they select their interests from a dropdown that is a Relation to the interests table). Then in the interests table, you can have a column called “People interested in this”, and select Linked Relation → People (this will automatically grab all the people who have this interest).
Then the email formula will be much simpler, something like thisRow.interest.[people interested in this].[email address]
(And by the way, your sample code is slightly off pattern. Rather than doing ForEach...If, it’s usually better to do People.filter(interests.in....))
Topics
|__ Animal • each row with a unique animal: Goat, Cat, Dog, Bird
People
|__ Name
|__ Interests • multi select list from Topics
|__ Email Address
Newsletters
|__ Title
|__ Topic • single select from Topics
|__ Action • with a button to send the email
|__ Content • the body of the email
Ideally I would add a row to Newsletters, assign a topic and hit send to address just the people who have selected that topic in their list of interests.
In general, I like to do intermediate calculations in columns where possible, rather than over-complicating formulas. If you wanted to take this philosophy a step further, you can prepare the message content in a Compose column, and then just reference that column in the formula above.