2 Replies Latest reply on Sep 21, 2009 4:34 PM by RobPinhood

    Save as PDF script fails

    RobPinhood

      Title

      Save as PDF script fails

      Post

      I am trying to run a script to save a one page record as a PDF so it can be emailed, but the script does not work.  I can run each operation from the menu, and everything works fine. The PDF is created correctly.  Running the script produces no PDF file, and NO ERRORS.  I have added a wide range of custom dialog steps to display the values of the variables at every point, and everyhting seems correct, yet NOTHING HAPPENS!

       

      ...

      Set Variable [$pdfFileName; Value:"CofC"&Database::RecordID&".pdf"]

      Set Variable [$pdfFilePath; Value:"filewin://Svrname/VOL/SHIPPING/" & $pdfFileName"]

      Save Records as PDF [Restore; $pdfFilepath; Current record]

       

      I'm Stumped!!!  Does anyone see something wrong in the lines above, or have an alternate way to create this functionality?  Any suggestions would be greatly appreciated.

       

      (Running FMPro 8.5 on WinXP Pro machines. 

      Files are hosted on a Win SBS2003 server running FMServer 9.0)

        • 1. Re: Save as PDF script fails
          TSGal

          RobPinhood:

           

          Thank you for your post.  It's difficult to determine where the problem lies.  Create a global text field, GLOBAL, and immediately after your Save Records as PDF script step, insert the script step:

           

          Set Field [ GLOBAL ; Get ( LastError ) ]

           

          Run the script, and if "800" appears in GLOBAL, then it is having trouble creating a file on the disk.  Check for other error codes at:

           

          http://filemaker.custhelp.com/cgi-bin/filemaker.cfg/php/enduser/std_adp.php?p_faqid=6449

           

          Although this Knowledge Base Article references FileMaker Pro 9, they include the error messages for FileMaker Pro 8.5.

           

          TSGal

          FileMaker, Inc. 

           

           

          • 2. Re: Save as PDF script fails
            RobPinhood
              

            I had tried to retrieve the script results by assigning the Get (ScriptResult) to a variable, and displaying the variable value in a custom dialog before the script had completed.  Creative self sabotage?  By assigning the Get(Last Error) to a GLOBAL field, it allowed me to see that I had set an invalid PDF parameter AND SET THE SCRIPT TO RESTORE IT!   The script now works perfectly.  

             

            Thx TSGal!