Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

basic email body question

Featured Replies

I think this is a really simple thing to do and I hope someone can help.

How do I send an email that has in the body

the data from one field for all the records in the table? (for example, a list of First names of everyone in the database.)

I can get it to send an email that has the field from only one record at a time-- I can't figure out how to get it for all the records (or the records from a found set.)

Please help!

Hi,

Create a global field which should return text.

Write a script:

set field(newGlobalField,"")

Show all records

Go to record [first]

loop

if trim(firstname] <> ""

set field(newGlobalField, newGlobalField & "<Use the new line character>" & firstname)

end if

go to record [exit after last, next]

end loop

send mail[]

In the send mail script step, select the new global field as the body of the text.

--Sanjai

  • Author

Thank you Sanjai,

This works perfectly except for one big problem. It generates the email correctly, but then I get a message that Filemaker has generated errors and it shuts down. not good!! Any thoughts?

Hi,

Hmm. It would be good to look at your script before giving you a solution.

I would suggest not to use the same file again and replace it if you have taken a backup.

To debug, in the start of the script, select set error capture[on] and after the send mail script step, enter:

if status(currenterror) >0

exit script

end if

I am not very sure about it because as you said that the email is generated properly. Give me some more details like to help me investigate.

--Sanjai

  • Author

Post deleted by MarijaK

  • Author

Here's the whole script as it is now.

It creates the email correctly, but then shuts down filemaker.

Set Field [DBname::GlobalField;""]

Show All Records

Go to Record/Request/Page [First]

Loop

If [Trim (DBname::Field) <> ""]

Set Field [DBname::GlobalField; DBname::GlobalField & "#" & DBName::Field]

End If

Go to Record/Request/Page [Next; Exit after last]

End Loop

Send Mail [To: "[email protected]"; Message: DBname:GlobalField]

except instead of # it is the paragraph symbol

Hi,

Would you like to verify if by mistake instead of using a global field, you are using a text field? I have done it some times where I have created a field starting with "g" and then have forgotten to change the datatype. Otherwise I don't see anything wrong with the script.

--Sanjai

  • Author

I did make that mistake at one point, and it caused a problem with the email body only including one record, but I changed it to a global field and the email is working correctly now. However, FileMaker still crashes every time I run it. I even went to the backup and re-wrote the script but it is also crashing the program.

Hi,

Could you please try the set error capture[on] script step as I in my previous reply. If you perform the send mail script step without checking the checkbox to "Perform Without Dialog", does the email gets generated? If yes, after that if you send the email manually, FileMaker Pro crashes or simultaneously?

--Sanjai

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.