Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6530 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a portal with the list of customers who bought a specific item. I'd like to send a group email to all the customers in this portal.

I guess I have to use scripting but how ?

When I assign the Send mail to a button in the portal, it only send to the specific customer so kinda stuck.

Thanks

Posted (edited)

You have to gather the related email addresses and separate them with a semi-colon ";".

A script such as the following would do it for you:

# Get the number of related records if any

Set Variable[ $i ; Count( RelatedTable::PrimaryIDField )]

Loop

...Exit Loop If[ $i = 0 ]

...#Check to make sure email address exists for the current entry

...If[ not IsEmpty( RelatedTable::YourEmailField ]

......Set Variable[ $emailAddresses ; $emailAddresses & "; " & GetNthRecord(RelatedTable::YourEmailField ; $i)]

...Set Variable[ $i ; $i - 1 ]

End Loop

#Get rid of the extra semi colon we put in front of the first email address

Set Variable[ $emailAddresses ; Right( $emailAddresses ; Length($emailAddresses) - 2 )]

#Finally check to make sure that after all that there are actually email addresses in our variable (for example, records could exist but there might not be an email address)

If[ IsEmpty($emailAddresses) ]

...#What to do if there aren't any email addresses

Else

...#What to do if there are email addresses i.e. your send script -- set the To field to be: $emailAddresses

End If

Edited by Guest
Forgot GetNthRecord... Don't know why.
Posted (edited)

Hey GenX:

Wouldn't your solution show all email addresses to all customers. What if you don't want your customers or possibly your competitors seeing your customer list. Especially their email addresses?

Couldn't you add to the loop:

Go To Portal Row (Next)

Send Mail()

So each email is sent separately?

This is just a question. I know these are probably not the correct commands. I use SMTPit to do all my email and mass email so I am not thoroughly familiar with the Send Mail function.

Al

Edited by Guest
Posted (edited)

FileMaker can send multiple emails and group email addresses together as well.

Try doing something like this if you have a setup of Customers, LineItems, and Items tables. I am assuming that you have a Layout from the Items that shows a portal of customers that bought the item.


Go to Related Record [show only related records; from table:"LineItems"; using layout: "LineItems" (LineItems)]



Go to Record/Request/Page [First]

Set Variable [$noemail; Value:""]

# 

# Loops through customers and gathers names with no email address

Loop

  If [isEmpty ( Trim ( Customers::email ) )]

  Set Variable [$noemail; Value:Customers::firstname & " " & Customers::lastname  & ¶ ]

  End If

Go to Record/Request/Page [Next; Exit After Last]

End Loop

#

# Displays popup window with gathered customer names without email addresses

If [$noemail  ≠ ""]

  Go to Layout [original layout]

  Shows Custom Dialog ["Missing Email Address"; "The following customers have missing emails. Please enter email addresses for them."  & ¶  &  ¶ & $noemail]

Else

#

# If all have email addresses then send mail

# Use option: "For each message, collect addresses across found set"

  Send Mail [To:Customers::email ]

End If

Go to Layout [original layout]

Dont forget to check the option of "For each message, collect addresses across found set" in your send mail step.

If you dont want everyone to see each other's addresses, use the "BCC" field instead of "To" and send it to yourself.

Edited by Guest
further details
Posted

Oh riiight, i always forget the nifty features FM sometimes has -- I normally use a plugin here so pardon my ignorance.

This topic is 6530 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.