Jump to content
Server Maintenance This Week. ×

Need Help Refining Script--problem with duplicate E-mails...


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

Recommended Posts

Hello,

I'm oh so close to getting my script to work properly! It's a script (credit to bcooney!) that I use to Email invoices as .pdf attachments. Only part now that I can't seem to figure out is whether it's possible to make it such that a found set of records that contain the same E-mail address(es) go out as only one E-mail with multiple attachments, rather than several E-mails to the same person(s) going out with one attachment.

Attached is a screenshot of the script I have so far.

Thank you so much for any help/input!

post-104263-0-59817700-1343783715_thumb.

Link to comment
Share on other sites

I guess you would have to loop through all the records and check if there is a repeated e-mail address, and then handle that situation.

Or you could create a self related table (by e-mail address) and count the number of times an e-mail is repeated.

In any case, if the number is >1 ; then you could do whatever you want to...

It could also be done with the new ExecuteSQL() function but I believe it will be a little bit more complicated...

IMHO you're gonna need to add more lines to your script :/

Please tell me if you need further help.

Link to comment
Share on other sites

I'll check out the first option...SQL is waaay beyond me! I wasn't even sure where to start with something like this, so your input helps. Thanks for the reply...I'll have a play and see how it goes!

Link to comment
Share on other sites

ok fmhappyguy, I'm really struggling here... would you be able to give me an idea of how to create the sort of script you're talking about? I'm still sitting here staring and just don't know where to start... :sad:

Link to comment
Share on other sites

Hello, yes it is true. You cannot use FM natively to send an email with formatting or graphics (html email) or more than one attachment. If that is what you need, then you need a plugin.

I'm not clear on your requirements, though, and why you need more than one attachment.

You have a Constrain Found Set that has no parameters in your script. Also, we cannot tell from the script what the subscript "Find INSIDE..." does. Where are you when it ends and with what found set?

Perhaps what you need to do is find the children, and then gtrr match found to the parent records, and loop there.

hth,

Barbara

Link to comment
Share on other sites

Hi Barbara,

Thank you for your help and thank you again for your awesome Invoice Demo for which this is modeled after!

The overall scenario is this: Every month I have a set of records that are jobs we are closing down. This set of records has a subset of records organized by "Department." Each Department has a Fund Manager, to whom we send Emails of these invoices to every month when the job closes.

I figured out that I can do a find using the "Department" field. I can then send an email to the Fund Manager of that particular department with the invoice attached as a .pdf. I changed "current record" to "records being browsed" so that all the records for that department is sent as one attachment to the Fund Manager.

What I can't figure out now is how to make the script work so that if for a particular month, there are no records found for a specific department, how do I make the script just move on to the next step? Is it even possible to create a script to skip script steps given certain situations?

Thank you again....

Link to comment
Share on other sites

As Barbara said, the easiest way to email multiple attachments is using a plugin (SMTPit, mail.it, or 360works Email). FileMaker has no native ability to do that.

To script certain things to happen when certain conditions are met, you use If/Else script steps. For example:


If( Get( FoundCount ) = 0 )

  Go to layout( original layout )

Else If( Get( FoundCount ) = 1 )

  Go to layout ( detail )

Else

    Go to layout ( list)

End If

Link to comment
Share on other sites

  • 4 weeks later...

While FileMaker has no native tools for multiple attachments you can accomplish the same thing but building your PDF into multiple invoices. You can use scripting and variables to get you found set of invoices and after saving the 1st as a PDF to the temp directory you an append to PDF the rest of them. Then you will have one PDF with multiple invoices and you can attach that to the email.

We have done this before for a client who need to attach multiple expense reports along with an invoice to customers.

And while I don't think it is worth it. You can construct some pretty rich text emails without a plug in using the GetAsCSS function

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

fmpdan303, I just saw your post from way back in August! As it turns out, I'm in a situation now where what you described is EXACTLY what I need to do. Would you be able to go into more detail as to how I can go about accomplishing this?

While FileMaker has no native tools for multiple attachments you can accomplish the same thing but building your PDF into multiple invoices. You can use scripting and variables to get you found set of invoices and after saving the 1st as a PDF to the temp directory you an append to PDF the rest of them. Then you will have one PDF with multiple invoices and you can attach that to the email.

We have done this before for a client who need to attach multiple expense reports along with an invoice to customers.

And while I don't think it is worth it. You can construct some pretty rich text emails without a plug in using the GetAsCSS function

Link to comment
Share on other sites

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