AnsweredAssumed Answered

Slow routine, to generate and reimport PDF and send mail, after updating to FMP 14 from FMP 12.

Question asked by Magnus Fransson on Nov 20, 2015
Latest reply on Nov 20, 2015 by Magnus Fransson

Hi all,


Being a long time reader of this forum, I have a lot to write about this.

I am an experienced FileMaker developer, but I’m used to have other developers surrounding me that do web, server configuration and other “specialized” things. My specialties are core FileMaker stuff like data normalization, tables, fields, relationship graph, calculations and scripting.


Now I am the sole developer on a company internal Customer, Order, Stock and Invoice system. (I actually started on it, as a customer solution, when I worked at a FileMaker consulting company.)


Being held back by plugins not being 64 bit compliant we recently upgraded all users and the production server to FMP 14 from FMP 12. (I have since the release, been developing in FMPA 14 and a development server running FMS 14.)


The hardware for both the servers is some sort of NAS units with RAID 5/6. That is running some version of Linux and a virtualization software, and on top of that, Windows 8 Enterprise (see picture). I have not chosen that setup but it seems to be sufficient for our needs.




Besides the upgrade there have been some other complications as well.

A few days after upgrading, the disks on the production server started to “crash”, one after another. (The system proved to be 5 years old, with identical disks.) We are extremely happy that we got a pristine copy out of it in time, only losing a few days’ work worth of data. (As the RAID went down, all files on that NAS, including backups, where lost.) Those files are now hosted on, what use to be, the development server.


After that castling of servers, we are experience a huge performance issue when confirming orders.


I’m using Dacons Mailit plugin to send the mails. And the container field is setup to use external secure storage.


The script is doing these main steps:

* GTRR and popup a new window with the print/preview layout.

* Sorts the records.

* Switch to preview mode.

* Assigns a variable ($File) to the proper calculated file name and path. (Using Get(TemporaryPath) and all other prerequisites.)

* Creating the PDF, using the variable ($File).

* Changing layout (and context) to the “History” table. And switch to “browse mode”.

* Creating a new post and setting some fields.

* Reimporting the PDF, into a container field, with Insert File[] script step, using the variable ($File).

* Committing the record.

* Closing the preview window.

* Opening a “send mail” window.

* Filling in all the prerequisite fields.

* Calling the “send mail” script.

* “Creating” the mail, by writing all the prerequisite data to the plugin.

* Sending the mail. (Using the plugin)

* Checking if the mail was sent “error free” and informing the user if not. Setting appropriate “flag” to indicate the matter in the “mail history post”. (Makes resending easy.)

* Closing the “send mail” window.

* Updating the “Status” of the order to “Confirmed”.



Now, this works and has done so for several years.


I have updated the “send mail” script to call it self on the server, using the “Server side catch” technic described by, among others, Matt Petrowsky. And if you run it on FMP 12, it runs locally. This works as well.


The problem seems to be the Insert File[] script step and some thing inside the “send mail” script (I believe the “send mail” step, but that remains to be confirmed) that is extremely slow (in the tens of seconds range) to perform in FMP 14 but is “instantaneous” in FMP 12 (on the same server).


Can any one help me improve the speed of this?



Best regards Magnus Fransson.