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.

Sending Emails and saving PDF files

Featured Replies

Hi there,

While I am working my script, I am using the loop function to generate my end-of-month balance sheet for my customers. I therefore list in Preview mode the summary of all the invoices each customer ows me. This can only be done in preview mode since I utilize the summary and total function to add up the invoice amounts. Once the first page is generated, I a save it to PDF under a filename (I have already tried to save it as a $variable but the problem did not go away!).

Next, I want to send the saved PDF file to my customer via mail. So I do a "Send Mail" and specify the email address which is strored in the current field's record. The Problem, is that Filemaker does not want to read that email address. As far as I am concerned it's because I am still in Preview mode! However, if I insert just before the Send Mail, a "Enter Browse mode", it does not change the problem.

Example:

Go to Record/Request/Page

Loop

Enter Preview Mode

Save Records as PDF [ File Name: filewin:/D:/Releve de compte FEDEX.pdf ; Records being browsed ]

Enter Browse Mode

Set Field [ GACPPT-EXPORT::SMTP Setup Return; SMTPit_Clear &

SMTPit_SetTo( ${GACPPT-EXPORT}???:Client Email; SMTPit_Append ) &

SMTPit_SetSubject( ${GACPPT-EXPORT}???:SMTP Email Header; SMTPit_Append ) &

SMTPit_SetBody( ${GACPPT-EXPORT}::SMTP Email Message; "Text"; SMTPit_Append ) &

SMTPit_SetAttachment( "d:Releve de compte FEDEX.pdf" ; SMTPit_Append ) &

SMTPit_Send ]

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

End Loop

(Note: The SMTPit doesn't change much. It simply is a different way of sending a Mail just like "Send Mail" from FM9Pro

The outcome here, are various different emails with the correct PDF attached file, yet the destination email address is always the same. It's as though Filemaker,take the stored email address of the first record and does NOT continue along!

Any ideas? I can't find the solution!!!

Thanks,

Alexander

Edited by Guest

Welcome TriMan!

Thoughts:

1. Are you looping thru Customers? Seems like you are looping thru invoices. I believe that you should be looping thru Customers, and gtrr Invoices using the layout for the PDF.

In Customers (possibly found set)

Loop

if related Invoices

gtrr invoices, report layout

sort for subsummary report?

set $export path {I'd use the Get (temporarypath) & filename.pdf}

go to layout Customers //back to customers

Send Mail

next rec, exit after last

End Loop

I see $var in your SMTPit_SetTo statement. When are these set?

Edited by Guest

  • Author

Hi bcooney,

Thank you for your thoughts. I never worked previously with gtrr and now thanks to you I am trying out this function. I rethought my way of working and still have a problem.

If I lauch a gtrr from my customer list, the how can I create a list that gives me a list of all the related records for that customer but ALSO for a time periode. The gtrr will generate a list of all the invoices from my customer that's great ... but now how do I then add a "find criteria" to also include the time period from for example 04/01/2009 ... 04/30/2009?

Thanks so much for your help!

Edited by Guest

You need a relationship from Customer to Invoices that has multiple predicates.

In Customers, create two global fields gDateStart and gDateEnd.

Then, build a relationship from Customer to Invoices that matches:

CustomerID and

gDateStart <= InvoiceDate and

gDateEnd >= InvoiceDate

Populate the two gDate fields with values and use this relationship in the gtrr to find all invoices for the customer for the given date range. You could also include a filter for balance due...

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.