4 Replies Latest reply on Jun 6, 2016 4:22 AM by keywords

    Send Mail

    JohnTurner

      I have FM 13 pro advanced and I am looking to send an email of the last record or any other particular record. I have written a script but it will only send the first record even though I have included 'save records as PDF and Records being browsed'. Do I need to add a further line to the script to select a particular record?

        • 1. Re: Send Mail
          ucharles

          I don't quite understand why you first have to get it in PDF. Why not just write a script just find the particular record or records and "send mail"?

          • 2. Re: Send Mail
            monkeybreadsoftware

            can you post the script?

             

            Saving records as PDF should write a file on disk.

            Than sending email you should be able to attach this file.

            • 3. Re: Send Mail
              JohnTurner

              Hi Christian

               

               

               

              I am a filemaker novice but looking to learn quickly. The script I am using was one I drew from a starter solution to forward payslips to employees. I can make this work if I update the figures in the record each month but keep it as one record. I would like to be in a position to have a record for each month, only updating the appropriate fields and select which record I forward to the employee.

               

               

               

              I trust the above makes sense and have set out the scrip I am using below:-

               

               

               

              Email Payslip

               

              Set Error Capture  Freeze Window

               

              Go to Related Record [ From table: "Payslip Information" ; Using layout: "Payslip" (Payslip Information)]

               

              Print Setup  [Restore; No dialog

               

              Enter Preview Mode

               

              Adjust Window [Resize to Fit I

               

              Pause/Resume Script [Indefinitely I

               

              If [ Get (LastError) = 0

               

              Set Variable [ $PATH; Value:Get (TemporaryPath) & Payslip ' & Payslip::Payslip ID & ".pdf

               

              Save Records as PDF [ File Name: "$PATH"; Records being browsed]

               

               

               

               

               

               

               

              [Restore; No dialog

               

              Send Mail [ Send via E-mail Client ; To: 'jtlittlefen.net'; Subject: Payslip; Attachment:            "$PATH"]

               

              Close Window

               

              Go to Layout [ "Payslip Information" (Payslip Information)

               

              End If

               

              Thank you for your interest and support

               

              Best wishes

               

              John

              • 4. Re: Send Mail
                keywords

                Sounds to me as if your script is not properly isolating the record to use. The best way is probably to capture the recordID as a variable at the start of your script, then use Find Matching Records to isolate just this one record, then send your email.