1 Reply Latest reply on Dec 15, 2009 12:51 AM by ianmanning

    Email PDF of Current Record

    TSADesign

      Title

      Email PDF of Current Record

      Post

      I am trying to create a script that would allow me to email a pdf of the current record. I'm running into problems in saving the file and specifying the subject line of the email based on two of the fields in my current record, i.e. Company Name & Quote Number.

       

      Ideally I would want the subject line to read something line, "My Company quote for Company B - Quote Number 00002", and the file name to be named "Company B - Quote Number 00002".

       

      I've been able to generate the PDF, and create and attach to an email. However the name is always the same based upon the path that I specified in the Save Records as PDF script.

       

      Thank you in advance for your help with this.

       

      TSA 

        • 1. Re: Email PDF of Current Record
          ianmanning
            

          The best way to do this is create a variable in the script which builds the path including the file name you want then use the variable name in the save record as PDF.

          Take a look at a previous post Generating file names when creating PDF's Below is what I said there.

           

          When specifiying the file path the back slash \ has to be replaced with a forward slash /

          if you look at the specify output file part of the script step it shows examples of how the file path should look. remember to include the header part ie filewin:// in your calculated path.

          In senriz's example he generates a local variable to hold the file path called $fileName (the $ is critical as it identifies it as a local variable in the script) he then concatenates (links together into one long string) using the & command

          "file:"  relative path identifier

          Get(DesktopPath) returns the directory path for the desktop folder

          JobTable::Job_Number  your field which holds the jobnumber

          "specs.pdf" the final part of the filename you want.

           

          if the job number was 12345

          the variable would hold something like file:/C:/Documents and Settings/manning/Desktop/12345specs.pdf

          Get(DesktopPath) actually returns /C:/Documents and Settings/manning/Desktop/ so make sure you dont add to many /

          I save a report of new quotes to send to our sales guys using the following path filewin://Ukex-as-1/filemaker/Reports/New quotes.pdf it is run from the remote database and saves on the server where filemaker server 10 is installed.

           

          I hope this helps

          Ian