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

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

Recommended Posts

Posted

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!

Posted

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

Posted

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?

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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

This topic is 7136 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.