8 Replies Latest reply on Feb 27, 2015 3:27 PM by brackinm

    Script export to excel and attach to email - no attachment

    brackinm

      Title

      Script export to excel and attach to email - no attachment

      Post

      I can create the excel file. I can send the email. But the file is not attached. I have tried both the get (documentspath) below and a hard coded file path. Neither works. What am I missing

        • 1. Re: Script export to excel and attach to email - no attachment
          philmodjunk

          Is this the method that you are using? (which should work).

          Calculate your File path and set a variable to that file path.

          Use the $path variable with export records to export your data to the specified file name and location.

          In the Send Mail script step's dialog, click the attach button and enter the name of the path variable as the name of the file to be attached.

          For more on the use of $path variables, see: Exploring the use of a $Path Variable in Scripts

          • 2. Re: Script export to excel and attach to email - no attachment
            brackinm

            Yes this is the script I am using. I have tested in as a scheduled server script and on a local client.

            • 3. Re: Script export to excel and attach to email - no attachment
              philmodjunk

              If you have FileMaker Adavnced, enable the debugger and use it to step through your script looking for issues.

              Other than that, you'd need to post your script here to see if someone can see where your script is going wrong.

              To post a script to the forum:

                     
              1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
              2.      
              3. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Script export to excel and attach to email - no attachment
                brackinm

                I have attached the script. Weird this script was working for about a year. Upgraded to 13 in December and has been sending weekly with no problems. Last we it stopped attaching the file. Could lit be something on the E-mail server side?

                • 5. Re: Script export to excel and attach to email - no attachment
                  philmodjunk

                  No script appears in your comment. Perhaps you tried to upload a PDF?

                  Be advised that you cannot use upload an image to upload any files that are not image files of the type GIF, JPG or PNG. That's one of the reasons why I posted a list of methods that do work by uploading either an image file or by pasting text directly into Post a New Answer.

                  • 6. Re: Script export to excel and attach to email - no attachment
                    brackinm

                    delinquent report temp Copy

                    Go to Layout [ “Delinquent Report” (Employee Compentancies Checklist) ]

                    Perform Find [ Specified Find Requests: Find Records ; Criteria: Employee Compentancies Checklist::ECC date completed : “=” AND

                    Employee Compentancies Checklist::ECC sent : “<1/1/2015” AND Employee Compentancies Checklist::Active status : “=active” ]

                    [ Restore ]

                    View As

                    [ View as Table ]

                    Sort Records [ Keep records in sorted order ; Specified Sort Order: Employee Compentancies Checklist::Department ; ascending ]

                    [ Restore; No dialog ]

                    Set Variable [ $filepath ; Value:Get ( DocumentsPath ) & "delinquent.xls" ]

                    Export Records [ File Name: “$filepath” ; Character Set: “Unicode (UTF-16)” ; Field Order: Employee Compentancies Checklist::First

                    Name

                    Employee Compentancies Checklist::Last Name

                    Employee Compentancies Checklist::Department

                    Employee Compentancies Checklist::ECC Name

                    Employee Compentancies Checklist::ECC date completed

                    Employee Compentancies Checklist::ECC sent ]

                    [ No dialog ]

                    Send Mail [ Send via SMTP Server ; To: "michelle.brackin@cortland.edu"; Subject: "Ecc's that have not been completed and sent to HR";

                    Message: "Please reveiw and complete all ECC's."; Attachment: “$filepath” ; Name: "ECC delinquent"; Email Address: "auxiliary.

                    services@cortland.edu"; SMTP Server: "ascbe13.asc.local"; Port: 25; Authentication Type: None ]

                    • 7. Re: Script export to excel and attach to email - no attachment
                      philmodjunk

                      I can see that you are exporting to an .xls file format and not the newer .xlsx format.

                      Is the file to be attached to the email ever created?

                      If you can open your documents folder and find the file (and it's not a copy produced previously), then I wonder if the email is being dispatched before the exported file is generated. That can happen with a PDF, but am not sure if it's possible with a file generated by export records.

                      But you might, as a test, try setting the export file to pen automatically and to put an indefinite pause after the export step. WHen you see the file open, close it and then continue the script.

                      If that works, you can set the file back to not opening and try using a pause for a specified short period of time...

                      • 8. Re: Script export to excel and attach to email - no attachment
                        brackinm

                        You are a genius! a 10 second delay allowed the email to go through with the xlsx attachment. It is 6:30 pm Firday night an I can go home because of you!