Like every FileMaker developer, I was also looking for a bunch of different techniques to make my solution do what I want to do. I found lots of different and very useful techniques which helped me move forward and to grow Benroy Business App to the level where it is right now.
It’s critical to deliver new updates when you develop commercial solution or development is separated from the main use. Usually you plan your updates, but sometimes you are required to do it very fast, because somebody found critical issues and it has to be fixed ASAP. So you do not want to think about routine updates at the moment, you just need to deliver it now. This post is about techniques which will let you update your FileMaker solution with just one click.
I would like to share some techniques that I had figured out by myself, which means I could not find any resource how to do that.
This post would be my first post in the FileMaker Pro Tips category and it will be about how to upgrade FileMaker solution with just one click. It took me days to figure out how to do this, but I succeeded and would like to share it with other FileMaker developers.
If you need to upgrade your FileMaker solution on mobile (iOS), you should read this article. By the way, I found this article very useful for me to start thinking about this technique. It’s a completely different approach, but it’s useful if you have FileMaker Go only solutions.
The main problems I’ve been facing to
Update process should work without any user interaction, except asking if he wants to install new updates. While searching for the best workflow I’ve faced these main issues, which are not common in FileMaker:
- How to close the file when the scripts runs and how to proceed the update process from the new file?
- How to locate a user’s file path dynamically and deliver new update there? How to find out where everyone store their files and how to deliver to the right place?
Basic overview of the update workflow
First of all you will require these tools to succeed for this technique:
- FileMaker Pro Advanced
- FileMaker Server
- FileMaker Pro solution.
Here is a chart that shows what the workflow is:
From the first look it looks confused, but here it is what every step does:
- FMP Solution (old) checks for new version at Update Server.
- If new version released FMP Solution (old) file prepares to update, saves a copy of itself and names it Backup_FMP_Solution.
- Then downloads the Update Capsule to the same location as FMP Solution (old) is.
- Update Capsule exports FMP Solution (NEW) to the same location.
- Update Capsule closes FMP Solution (old) and opens FMP Solution (NEW).
- FMP Solution (NEW) import data from Backup_FMP_Solution.
- FMP Solution (NEW) deletes Update Capsule.
FileMaker Script Steps used in the technique
We are familiar with a workflow now and can understand how it looks inside FileMaker. The scripts are in all 3 files which every of it has in its important part. Here is how the queue of the scripts looks like and from what file which script runs:
- Check for new version script runs from FMP Solution (old) file. And it starts the whole update process.
- Setting the file Path is critical to download the new version to the right place. There is no default place where everyone stores their files, so without that step the Update process will not work.
- I use customer name to identify customers and to deliver the correct copy for them. But it could be used to deliver different options having a solution.
Tip. Records in the Update Server can be used to deliver the specific update to the user. For example, if your solution is dedicated to different industries you can store your solution updates in different records.
- When we get all parameters we can proceed to checking the version and if there is a new version, the user will be asked if he wants to download the latest version and update current solution.
Tip. Some other layouts could be added here, for example, if you want to show what the release notes are or ask to accept the EULA (End User License Agreement).
- The server will download the Update Capsule with FMP Solution (NEW) inside. The Update Capsule is like a vessel which has to deliver your solution and disembark the latest version. But before that the red carpet should be floored.
Prehistory. It took me many hours to find out how to distribute new files. I’ve been searching every possible FileMaker forums and tips sites, read all script steps at least twice with no luck. I couldn’t find the straight forward solution or the “golden” script step which could solve my problem. Then I started collecting the actions into groups and was searching what all actions has in common. And I’ve come to 3 (three) groups which were completely different. 1st group had actions from the old file and 2nd group had actions from the server. But some of them didn’t get into any of these groups, so I decided to create a separate file where I just added all those inappropriate actions. The next morning I came back, opened all 3 files and found out that the 3rd group of actions perfectly meets the workflow, it just has to be run from separate file. And that’s how the Update Capsule was born.
- Once again we had to add the current solution path into the capsule as well. That’s why this script is required.
- This script makes the biggest part in the Update process. It creates a backup of the old fmp file and start the restore process.
- The script step “Install on timer” does very important part and solves the problem that I mentioned in the beginning. During the timer period, we should close the old file and start the new one. Once it’s open we can start the restore script step.
- This script prepares the FMP Solution (OLD) for backup and creates a copy of itself. Prepares the file for backup, which means that all records in the FMP solution should be showing up. As you probably know, when you import data from other *. fmp12 file FileMaker import records only from the last found set.
- This script runs the data import routine from an old file. It just imports data from all tables that are in the FMP Solution.
- Finally, our data is restored to the newest version. So we have to do some cleanup steps. We will delete the update capsule using very simple technique: exporting the empty container field content to the path where the Update Capsule is located.
Tip. We can delete the backup file the same way, but I like to keep the copy of the old version in case something goes wrong.
That’s it! We did the update of the FileMaker Pro solution.
Some things has to be kept in mind!
- Update process cannot be run once the solution is hosted on FileMaker Server. You have to download it first before proceed.
- The whole process works only in one folder.
- This technique does not require any plugins and is completed using native FileMaker functions and scripts.
- This technique perfectly works with FileMaker runtime solutions.
This technique has saved me lots of time, especially when you work in Beta version. I do not worry about delivery and update process any more. Also, I use part of this technique for restoring data from the backups. It usually happens when user messes up some of their data and it requires to restore. Script #10 restores data from the backup.
You can take a look at Benroy Business App documentation, for the upgrade instructions for regular users.
I’ve built an example file that shows how everything works. Please use it for your purposes and I hope this technique will help you as much as it does for me.
Note. I’ve removed my server address, so please do not forget to add your server address in the FMP Solution.fmp12 file at File > Manage > External Data Sources…
Please fill up the form to get the demo files: