Hi andyg4137 and welcome to the forum.
Could you give us more info on what you are trying to send via email? is it an attached PDF, spreadsheet or simply info in the body of the email from the database?
it can be a pdf or fields, that can be flexible.
i have been trying to run a repeating script to do a find on the consultants name which is picked up from a separate database using the get nth record which i haven't had any success with yet as it won't pick up the information
Ok this is doable, I just want to check first if you have a single record for each consultant in your consultants table?
And also does the process just need to email the PDF, or do you also want to store the PDF somewhere else?
Also which version of FileMaker are you using and on which OS?
First off its Filemaker 10 running on Vista
yes, there is just one record in the consultants database for each consultant but they will have up to appointments each per day.
sorry just needs to email the pdf
Ok, What you want the script to do is, starting with a found set of Consultants you want to email to, in a loop script, set variable to a searchable value from the Consultant record, go to the Diary layout and finds the appropriate records, PDF's them and sends the email, then goes through the whole thing again until it reaches the last Consultant.
your script will need to look something like this:
Set Error Capture [ On ]
Go to Layout [ ConsultantsDetails ]
# Get you found set of consultants or Show All
Show All Records
Go to Record/Request/Page [ First ]
# Start our looping process
Set Variable [ $ActiveID ; CONSULTANTS::UniqueID ]
Set Variable [ $ActiveName ; CONSULTANTS::Name ]
Set Variable [ $ActiveEmail ; CONSULTANTS::Email ]
Go to Layout [ Diary ]
Enter Find Mode [ ] // Make sure to deselect the option to Pause
Set Field [ DIARY::ConsultantID ; $ActiveID ]
Set Field [ DIARY::Active ; 1 ] // ? Whatever value marks it as active
Perform Find [ ]
If [ Get ( FoundCount ) > 0
#Got to Layout [ "DiaryReportLayout" ]
Set Variable [$FilePath ; "filemac:" & Get ( TemporaryPath ) & $ActiveName & "Report.pdf"]
Save Record as PDF [ No dialog ; "$FilePath" , Current record ]
# PDF has been created, now attach and send in email
Send Mail [ To:$ActiveEmail ; subject: "Report" ; "$FilePath" ]
Go to Layout [ ConsultantsDetails ]
Go to Record/Request/Page [ Next ; Exit after last ]
The PDF is stored in you temp folder and then removed when the machine is shut down or restarted
This should do the trick.
That is a great script.
Do you know of a way to do same/similar without requiring an email client (i.e. using the new SMTP server option in FMP10)
I can't find a way to attach a PDF without using an email client.
You will send the email and attach the PDF using the Send Mail script step
For the SMTP options, at the top of the dialog is the label 'Send Via:' change this to 'SMTP Server' and input all the appropriate settings,
For the To: simply input the name of the variable holding the email address $ActiveEmail
Then fill in the Subject and body as appropriate.
To attach the PDF the script creates, under the Message text area there is a tick box of 'Attachment', tick this and input the variable name, $FilePath, in the dialog that pops up.
Let me know how you get on with this.
That works very well, thanks !!
Instead of a PDF or Excel format, I used the Export as HTML Table...looks nice when viewed inline in the receive email client.
I search for a set of records, select my report layout, then send the email of the currently browsed records.
Thanks for the TIP.
No worries, glad to help.
hi, i have a similiar issue, but i want to send the contents of a found set, from list view, listed in the body of a single email. Instead an email per record, i just want one email for all found records in the body of an email, no attachments. What would i need to change to accomplish this?
Will this be straight simple text or will you be trying to apply more complex formatting to reproduce your report layout?
The second option requires an email plug in as filemaker cannot do this natively.
You might be able to do this with a list function or copy all records in a script. Best approach can depend on how you've designed your database and what you want to see in your report.
Copy all records method:
Perform a find and sort to pull up the group of records you want on a layout with just the fields you want to put in the body of your email.
Use Copy all records to copy the data into your clipboard. Data will be copied to the clipboard with fields separated by tab characters and records separated by return characters.
Switch to a different layout and paste the contents of the clipboard into a text field. The text field must be present on the current layout for Paste to work.
Use this text field as all or part of the body of your email.
wow that was easy. decided to just stick to the simple text. since the information being sent was straighforward and simple enough