4 Replies Latest reply on Mar 14, 2017 2:29 PM by GaoshengHuang

    Cannot run FMP scripts on FM server 14


      I am working on a project that exclusively relies on scripts to pull data from multiple files, transform the data, write the result into a new table/layout, and finally export into a  csv file. Everything works perfectly on the client side after running the scripts. But when I run the same scripts on FM server 14 as a schedule, nothing happens.


      Scripts used:

      Set variable

      Set field

      Go to layout

      Perform find

      Show all records

      Delete all records

      Go to record

      Loop ... End Loop

      If ...End if

      Export Records


      System Environment:

      Filemaker Pro Advanced 14

      Filemaker Server 14

      Windows Server 2012 R2 Standard


      Also, I am not so thorough about authentication issues. Anybody who runs the scripts puts an export directory so I am not sure how to make sure the server has access to the directory.


      Any suggestions are appreciated!

        • 1. Re: Cannot run FMP scripts on FM server 14
          Jason Wood

          Perform Script on server runs with the user account that called it, so that user must have the required permissions to perform the script.


          Also keep in mind that if you have a script for OnFirstWindowOpen, that script runs before any server script. Sometimes this could interfere.


          As for the export & file path, refer to FileMaker 15 Help: Export Records There are a variety of special considerations for server side scripts.


          Lastly, remember that you have to get to the correct context from scratch (go to layout, perform find, etc.)


          You can check the server logs to make sure the script completes.


          There were some discussions a while back about problems with scripts that required multiple files to be open. I'm not sure if this is still an issue but it was necessary to ensure the client had all the required files open before calling the Perform Script On Server script.

          2 of 2 people found this helpful
          • 2. Re: Cannot run FMP scripts on FM server 14

            Server side scripts can only export to specific locations and with only certain formats. That is the most likely issue. Note also that the documents folder to which you might have as the location for an export is not the standard documents folder on the server.

            1 of 1 people found this helpful
            • 3. Re: Cannot run FMP scripts on FM server 14

              Check the server logs to see what is happening with the server script.

              Also log get(lasterror) in the server scripts to see what is happening.


              The server script can only output files to the "documents" directory which is in the FileMaker server subdirectory.


              Finally if your file has a script that is triggered when the file is first opened, e.g. OnFirstWindowOpenTrigger then this script will also run on the server before your scheduled script is run.

              1 of 1 people found this helpful
              • 4. Re: Cannot run FMP scripts on FM server 14

                Thanks to you, and also to Jason and Phil! All your responses are helpful as I am not very familiar with server side scripts. Yes I did check the logs and and it did mention error 800 with the Export Records script. I set a $path to a folder on desktop, so I guess that is the problem. As you all mentioned, I should export it to Document folder under Filemaker Server. Will try and let you the result. Thank you very much!