3 Replies Latest reply on Oct 10, 2011 2:20 PM by TSGal

    email script (attachment) for filemaker GO

    KrisJones

      Title

      email script (attachment) for filemaker GO

      Post

      hi - wondering if anyone can help?

      i have a purchase order database set up - where i am sharing between 4x PCs and 4x ipads

      On the database i have a button that "emails purchase order" (the script copied from a starter solution - invoices)

      On the PC - when you click the button it opens a "new email", and attaches purchase order : perfect!

      HOWEVER

      on filemaker Go - the script does not work fully and only opens a "new mail", but does not attach order.

      HELP PLEASE?

        • 1. Re: email script (attachment) for filemaker GO
          TSGal

          Kris Jones:

          Thank you for your post.

          Unfortunately, I don't see the script attachment.  However, here is a script that will work on the iPad:

          Set Variable [ $FileName ; Value: "Invoice.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" ]

          The first step is setting the variable $FileName to the name of the PDF file you want to save.  In this example, I named the file "Invoice.pdf".

          The second step saves the file out to a PDF file.  I could have left out the first step and specified "Invoice.pdf" directly.  I used the "Records being browsed" option, but if this is an Invoice for one customer, then you will probably use "Current record" instead.

          The third step is storing the location of the PDF file into the variable $PDFPath

          The fourth step is to send the email, addressed here to user1@abc.com (but you could easily reference an Email field), Subject of "Invoice", Message of "Test", and attach the PDF file stored in the path $PDFPath variable.

          Although this works on the iPad, it may not work on the Windows/Mac machines.  Therefore, you may want to check first to see if this script is running on an iOS device or a Windows/Mac computer.  The function Get (SystemPlatform) returns "3" if it is an iOS device.  You can then modify your script to:

          If [ Get ( SystemPlatform ) = 3 )

             Set Variable [ $FileName ; Value: "Invoice.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" ]

          Else

             <your current script step(s) to send the PDF file on the Windows/Mac machines.

          EndIf

          -----------

          Let me know if you need additional clarification.

          TSGal
          FileMaker, Inc.

          • 2. Re: email script (attachment) for filemaker GO
            Bobster

            Hi TSGal,

            That's a helpful tip. Do you have any tips on how to, as a final step, Delete the PDF from the DocumentsPath?

            Methods such as Exporting Field Contents (of an empty field) to the $PDFPath, which work on FileMaker Pro, won't work on the iPad. There might be a command line/shell script method, but I've never seen one.

            Any ideas?

            Regards,

            Bob Stuart,

            Think Data Pty Ltd

            Queensland

            Australia. 

            • 3. Re: email script (attachment) for filemaker GO
              TSGal

              Think Data Pty Ltd:

              Thank you for your post.

              At this time, FileMaker Go (nor Pro) has a Delete File script step.  The file would need to be removed manually.

              I recommend that you add this suggestion to our Feature Requests web form at:

              http://www.filemaker.com/company/contact/feature_request.html

              These web entries are monitored and read by Development and Product Management where they are then discussed and considered for future releases.  Although I could copy your post and paste it into the web form, there are a couple of questions asked that only you can answer.

              TSGal
              FileMaker, Inc.