2 Replies Latest reply on Jan 23, 2013 9:38 AM by philmodjunk

    How can I prevent Filemaker from crashing when running a script (Send Invoice By Email) ?

    ostenzen

      Title

      How can I prevent Filemaker from crashing when running a script (Send Invoice By Email) ?

      Post

      I'm sending an invoice by email. I save the record as PDF and then I send the invoice via an email client. The script runs fine the first time I click the button but the second time around filemaker crashes. I tried to send the email via Outlook and  Moxilla ThunderBird but the second time around FileMaker always crashes. This is the script.

      Send Invoice by Email

      Set Error Capture   [ On ]

      Freeze Window

      If [ Get ( LastError ) = 0  ]

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

       Go to Related Record   [ Show only related records; From table:  “ItemLine” ; Using layout: “Print/Send Invoice” (ItemLine) ; New window ]

       Save Records as PDF  [ Restore; No dialog; “$PATH”; Records being browsed ]

       Send Mail [ Send via E-mail Client ; To: Client::EMail; Subject: "Invoice # " & Invoice::InvoiceID & " | " & CompanyInfo:: CompanyName; Attachment:    “$PATH” ]

       Close Window  [ Current Window ]

      End If


      Help to troubleshoot this issue is appreciated.

      -- Christian

      Newbie to FileMaker
                Moxilla Thunderbird
                Outlook 2007
                FileMaker 12 Pro Advanced
                Window 7 64 bit

            

      filemakerCRASH1.png

        • 1. Re: How can I prevent Filemaker from crashing when running a script (Send Invoice By Email) ?
          ostenzen

               I found out that removing logo placeholder and the companyinfo::logo container prevented filemaker from crashing.  My next question is: What script code should I use to allow FileMaker to reference logo placeholder and logo container. Help appreciated.

          • 2. Re: How can I prevent Filemaker from crashing when running a script (Send Invoice By Email) ?
            philmodjunk

                 Your file may be damaged. Not only can file corruption be the cause of a crash, but a crash can damage your file.

                 First thing you need to do is run a recover on your file. If it reports a problem, replace it, if possible with a copy that does not show a problem when you run a recover on it.

                 Even if recover does not show a problem, there may be issues with the two image files or the layout from which you are saving a PDF. You may want to create a brand new layout for your PDF and if that still results in crashes, try creating some new copies of your two image files and inserting them into your container fields.

                 Things to keep in mind about Recover:

                 While Recover almost always detects and fully corrects any problems with your file...

                   
            1.           The recovered copy may behave differently even if recover reports "no problems found".
            2.      
            3.           Recover does not detect all problems
            4.      
            5.           Recover doesn't always fix all problems correctly
            6.      
            7.           Best Practice is to never put a recovered copy back into regular use or development. Instead, replace the damaged file with an undamaged back up copy if this is at all possible. You may have to save a clone of the back up copy and import all data from your recovered copy to get a working copy with the most up to date information possible.

                  

                 And here's a knowledgebase article that you may find useful: What to do when your file is corrupt (KB5421).