1 2 3 Previous Next 41 Replies Latest reply on Nov 11, 2013 1:28 PM by jessicar

    Attach PDF into custom Email

    darylhansen

      Title

      Attach PDF into custom Email

      Post

      I just upgraded to the new version.  I'm so excited!!!!

      I have a script that creates the PDF and then composes a custom email and attaches the PDF to that email, but the PDF is not getting attached.  It will create the PDF and it generates the email, but it's just not getting attached.  Is there something to use in the syntax to get this to work with the iPhone and iPad?  I tried "file:filename.pdf", but it doesn't work.  Perhaps "iPad:filename.pdf"?

      How do I get this to attach?

        • 1. Re: Attach PDF into custom Email
          FileMakerProRocks

          Yes, it is very exciting, however:

          I have the same issue from my 'custom scripts' which create pdf's, but I found the pdf's will go into the FMGo 'Files on Device' folder. You know, the one when you startup FMGo. On tap, they open, but I cannot find the 'send by email' button.

          I guess, my 'send email' scripts for ie invoice, estimates etc, need to be changed. The only error message I am currently getting is 'Enter preview is not supported', it open an email for to the recipient, but NO PDF ATTACHED....

          Need to find a solution for that one!

          • 2. Re: Attach PDF into custom Email
            mtamitch

            Yep, I need this as well. Maybe it is a bug? or an unsupported feature at this time?

            • 3. Re: Attach PDF into custom Email
              TSGal

              Detlef Hebbel and mtamitch:

              Thank you for your posts.

              The file paths are different on a Mac and iPad/iPhone/iPod touch.  Therefore, you will have to modify your script.  Thanks to our Software Quality Assurance (Testing) department for providing the following sample script:

              Set Variable [ $FileName ; Value: "Test_" & Substitute ( Get ( CurrentDate ) ; "/" ; "-" ) & ".pdf" ]
              Save Records as PDF [ No dialog ; "$FileName" ; Records being browsed ]
              Set Variable [ $PDFPath ; Value: Get (DocumentsPath) & $FileName ]
              Send Mail [ Send via E-mail Client ; To: "user1@abc.com" ; Subject: "Invoice" ; Message: "Test" ; "$PDFPath" ]

              There is a caveat.  On an iPad/iPhone/iPod touch, the PDF files are not overwritten.  If you perform this script twice on the same day (for example, today being 9/23/2010), you will have "Test_9-23-2010.pdf" and "Test_9-23-2010 1.pdf" files, and the script would attach the original PDF file both times.  Therefore, make sure you have a way to make the filename unique.  One way is by appending an Auto-enter serial number field or using an incremental variable.

              Let me know if you need additional clarification.

              TSGal
              FileMaker, Inc.

              • 4. Re: Attach PDF into custom Email
                darylhansen

                I have confirmed that this works. Sweet! To put it into simpler terms, simply use the "Get (DocumentsPath)" calc and name the document something unique, if you are going to attach that document to an email more than once per day.

                • 5. Re: Attach PDF into custom Email
                  FileMakerProRocks

                  Yes, works perfect for FMGo!

                  Thanks a lot to TSGal and Software Quality Assurance (Testing) department for providing the sample script.

                  • 6. Re: Attach PDF into custom Email
                    mtamitch

                    Yes, thanks for that TSGal. I have it working now. 

                    • 7. Re: Attach PDF into custom Email
                      user14040

                      Can Some help out with the pdf email  I am new with scripting so I really not sure how to do this type of script but I did fumble through it.   This script I got from previous post where it is suppose to attach pdf to email and but the email address and subject.  Below is a image of what I changed but it is not working  the only thing it does is add the email address, the subject and in the message section it put TEST.

                      In the image below on the last line "$PDFPath"  I was not sure how to add it so I used the attach check box to add $PDFPath.

                      What am I doing wrong? 

                      pdf script

                      This is the original

                      Set Variable [ $FileName ; Value: "Test_" & Substitute ( Get ( CurrentDate ) ; "/" ; "-" ) & ".pdf" ]
                      Save Records as PDF [ No dialog ; "$FileName" ; Records being browsed ]
                      Set Variable [ $PDFPath ; Value: Get (DocumentsPath) & $FileName ]
                      Send Mail [ Send via E-mail Client ; To: "user1@abc.com" ; Subject: "Invoice" ; Message: "Test" ; "$PDFPath" ]

                      • 8. Re: Attach PDF into custom Email
                        TSGal

                        Lawfour:

                        It appears you are doing everything correctly.  However, It may be a misprint, as it looks like the last line of your script has an extra quote in front of $PDFPath.  Make sure when you click the "Attach file" checkbox that you are entering under "Specify...":   $PDFPath       That is, no quotes.

                        TSGal
                        FileMaker, Inc.

                        • 9. Re: Attach PDF into custom Email
                          user14040

                          You guys are great, thanks it worked perfectly.

                          • 10. Re: Attach PDF into custom Email
                            user14040

                            Duplicate PDF email sent, I forgot about this part;

                            How do I do this part since i will be sending a different record during the course of one day. 

                            Therefore, make sure you have a way to make the filename unique.  One way is by appending an Auto-enter serial number field or using an incremental variable.

                            • 11. Re: Attach PDF into custom Email
                              TSGal

                              Lawfour:

                              One possible workaround is to store a value in a global field and increment it each time you send an email.  For this example, create a Number field with global storage and name it g_global.  

                              Change the first script step to read:

                              Set Variable [ $FileName ; Value: "Test_" & g_global & ".pdf" ]

                              Instead of the date, this will append a number to the end of the $FileName.  Test_1.pdf, Test_2.pdf, etc.

                              The trick is to increment the field g_global each time you Send Mail.  Therefore, after the Send Mail step, add the script step:

                              Set Field [ g_global ; g_global + 1 ]

                              This will get the value ready for the next time you want to send an email as the file will then have a unique name.

                              Let me know if you need additional explanation.

                              TSGal
                              FileMaker, Inc.

                              • 12. Re: Attach PDF into custom Email
                                BERGSTEN

                                I'm trying use this script for my invoices, but it saves the PDF in the Filemaker Program file. How can I change the script so that I can save it somewhere else?

                                Also, I can't seem to get the file to attach to the email. The email opens and inputs all the specified data, but does not attach the pdf.

                                This is what mine looks like:

                                Thanks!

                                • 13. Re: Attach PDF into custom Email
                                  TSGal

                                  BERGSTEN:

                                  Thank you for your post.

                                  At this time, you cannot save the PDF file elsewhere.

                                  Can you verify the PDF file gets created?  If so, open the PDF file and make sure information is displayed.  If it is blank, then the email will appear as though nothing was attached when in fact is is a blank document attached.

                                  TSGal
                                  FileMaker, Inc.

                                  • 14. Re: Attach PDF into custom Email
                                    user14040

                                    Thank that worked for me

                                    1 2 3 Previous Next