4 Replies Latest reply on Jul 14, 2009 4:13 AM by TheNimbleOne

    Export and Attach to Email

    TheNimbleOne

      Title

      Export and Attach to Email

      Post

      Hello,

       

      In my employee expenses database I want to export a record as a pdf or excel spreadsheet and attached it onto an email for employees to send to the accounts department, all at the click of a button - I've got the email part working but how do I export a single record and attach it?

       

      Nimble 

        • 1. Re: Export and Attach to Email
          gunnerstudio
            

          The simplest way is to create button "Send Email" and let the this script do the rest 

           

          Enter Browse Mode 

          #Go to the record that you want save

          Go to Related record [From Table: "Tablename"; using layout: "email" (tablename); New window]

          #Setting destination of PDF you want to save

          Set Variable [$file.pdf; Value:Get (TemporaryPath) & "file.pdf"]

          #Saving as PDF

          Save Records as PDF [Restore; No dialog; "$file.pdf"; Records being browsed]

          #Sending the Email

          Send Mail [Send via E-mail Client; To: Table::Email Address; Subject: "subject for file;"$file.pdf"]

          #Closing the current window

          Close Window [Current Window] 

           

           

           

          hope that helps.

          Gunner 

           

          • 2. Re: Export and Attach to Email
            TheNimbleOne
              

            Thank you for your advice gunnerstudio, I am running FMpro version 7 on a mac, and I can't find the set variable option in the scripts ... any ideas?  

             

            Nimble x 

            • 3. Re: Export and Attach to Email
              mrvodka
                

              You will need at least version 8 to make things easy for you.

               

              Because you are using 7, you have to do things with big time work arounds. You can use a global fields instead of variables. You can use a print PDF creation program to create a PDF. You can use a different format such as csv or tab for your Excel export. You can not use the temporary path for export either.

               

              I would recommend upgrading to at least 8.5 or 9.

              • 4. Re: Export and Attach to Email
                TheNimbleOne
                  

                Thank you MrVodka, I will attempt to get my company to upgrade!