6 Replies Latest reply on Mar 11, 2016 10:28 AM by mcemond

    Server side script issue

    mcemond

      I have created the following script..

       

      Set Variable [$filename; Value: "All Employees - Time Sheet.xlsx"]

      Set variable [$path; Value : Get (DocumentsPath) & $filename]

      Go to layout [ "Time Cards Office - Full Screen" (logTime)]

      Enter Find Mode []

      Set Field [logTime::weekEnding; Date (1; 8; 1904) + ((Int((Get(CurrentDate) - Date (1; 9; 1904)) / 7) + 1) * 7)]

      Set Error Capture [On]

      Perform Find []

      Set Error Capture [Off]

      Sort Records [ No dialog]

      Export Records [ No dialog; "$path"; Unicode (UTF-16)]

      Send Mail [ Send via SMTP Server; No dialog; To: "myemail";Subject:"Remote server test"; Message: "test"; "$path"]

       

      So basically it grabs all the time log entries from the current work week and exports them to the Documents folder. Then it grabs the file and emails it off. So... this script works:

       

      if Run manually on both servers, my iMac AND ODI's ( I receive the email with the attached file ) and Run as a scheduled script on my iMac Filemaker server ONLY (same result).

       

      The script is not working as a scheduled script on a remote server hosted by ODI Tech. I have received confirmation from them that the files appear to be populating the ODI server documents folder but for some reason the email with attachment is not firing off. I receive the status email of:

      "FileMaker Server 14.0.2 on fms-301-nyc.oditech.com reported the following event:

      2016-02-26 22:30:00.379 -0500  Information  644  fms-301-nyc.oditech.com  Schedule "eastpoint_daily_script" completed; last scripting error (3)."


      644 = informational,  Schedule "%1" completed; last scripting error (%2).


      Unfortunately I can't see schedules through ODI server admin or their status etc.


      Because it runs as a scheduled script on my server here, the script itself must all be server compatible. And because files are being saved to the ODI folder, everything up to the export must be working there, so I'm not really sure what might be the issue. The script debugger revealed nothing. I know that the email is set up ok because the ODI server is sending me script generated emails (when performed manually) and I know the export and attachment process are server friendly because the script works 100% on my iMac server. So I'm not sure what I'm missing. Any help would be great. Thanks!

      Mike

        • 1. Re: Server side script issue
          fitch

          When you say "run manually" do you mean you're in the server admin console and told the script to run now? Or that you're running the script via your FileMaker client?

           

          I'd imagine the problem is in the configuration of the SMTP server, which wouldn't necessarily be the same on your server vs. ODI's. I've worked with ODI and had good experience with their tech support. They should be able to give you the correct settings.

          • 2. Re: Server side script issue
            wimdecorte

            A lot of reasons why this may not work.  The big one:

            - do they allow SMTP outgoing from their server?

             

            The returned error (3) is an indication that your script uses a script step that is not supported on server:

            3

            Command is unavailable (for example, wrong operating system or mode)

             

            Some side notes:

            - in your script you toggle error capture on and off, but you don't really do anything with that.  If an error occurs you don't trap for it or handle it.

            - the end-of-week calc is very convoluted and there are no comments for it.  You future self or anyone helping you / taking over from you will not appreciate it

            - you don't have "allow user abort off" in your script.  That means that any unsupported step will halt the script.

             

            so beef up your error trapping and write to a log file every step of the way so that you can figure out what parts work and what parts don't.

            • 3. Re: Server side script issue
              NickLightbody

              We have found that ISP's often don't expect smtp originating from the fmserver and have this disallowed without really realising it. We have had to push quite hard to get two different ISPs to acknowledge this issue was their issue and to fix it.

              Cheers Nick

              • 4. Re: Server side script issue
                beverly

                And ISP's with high security may have mail server/service from a separate machine. Not a "fix", isn't it a hole poked into the firewall to have SMTP on FMS?

                beverly

                • 5. Re: Server side script issue
                  mcemond

                  Thanks for all your helpful ideas. It has helped me narrow the field a bit. I reduced the script to just the single email step and put static values in it. The server fired it off with a 1506 error. Based on your comments I began to research email settings and found that gmail which I am using as my outgoing smtp server is prone to this error so I'm going to ask them if there is a known service that works better with scheduled scripts.

                   

                  As for the other items, I'll work on the error capture lack and put in a comments line for the date calc. The log file is another item I'll figure out how to write as I can see your point on its usefulness.

                   

                  I'll update this when I've got a better grasp of the solution.

                  Thanks again

                  Mike

                  • 6. Re: Server side script issue
                    mcemond

                    I've been testing this and implementing suggestions. As an update for anyone else running into this, I stripped the script down to a simple send mail line with only static content. I ran the attached smtp set ups and found that my old yahoo account was ok and received the email from the scheduled server run. I also had received a couple text messages that I had not been aware of and the latest one caught my eye - from google saying they blocked an attempt to login. I've since marked the attempts as, yes it was me. So hopefully tonight's run will see google send mail attempts pass as well. Then I'll add in the rest of the script and see how that goes

                    Screen Shot 2016-03-11 at 1.15.36 PM.png