Deploying Add-Ons Automatically with FileMaker 19

What is an add-on?

The ability to create add-ons is a new feature released in FileMaker 19.0.1. It allows users to quickly and easily add modules to FileMaker solutions. An add-on is a package containing the following:

  • Table schema
  • Table data
  • Table occurrences
  • Scripts
  • Custom menus
  • Themes
  • Layouts

These elements add functionality to a FileMaker solution with just a few clicks. What formerly took multiple copy and paste steps is now as easy as drag-and-drop.

Here is a video of this process:

How to create an add-on:

Here is the official Claris documentation on add-ons. Claris also released a video on this subject. The remainder of this article assumes you are comfortable using the add-on feature in FileMaker Pro 19.

How to deploy a custom add-on:

Using Save a Copy as Add-On Package will create an add-on with the default descriptive information, as you can see in the image below.

Default descriptive information of a new add-on

Here are three different methods that can be used to deploy an add-on to a new FileMaker installation:

  • Install the add-on on one machine, put the files in a compressed file, then extract it to the user’s add-on directory. A new compressed file is needed for every new version of the add-on.
  • Install the add-on on one machine and create an installer or script for deployment. A new installer must be created for every new version of the add-on.
  • Use a hosted FileMaker file to install the add-on on a user’s machine. The deployment script will have to be run again in case a new version of the add-on is released.

Note that add-ons are installed per FileMaker installation in the following directories:

MacOS: Library/Application Support/FileMaker/Extensions/AddonModules 

Windows: AppData\Local\FileMaker\Extensions\AddonModules

Deploying with FileMaker

It’s important to know that the descriptive information about the add-on is stored as JSON files in “UTF-8 with BOM” file encoding. FileMaker does not support writing files in this format. My workaround is to download a UTF-8 with BOM file that I uploaded to S3 and use in a container field. This method keeps the file encoding of the JSON files as UTF-8 with BOM. This may sound complicated, but it’s actually fairly simple. Check out the script in fmLog (at the end of this article) for an example of this technique.

Set up the deployment script (done once per module):

  1. Copy the “Save as add-on” script from the fmLog file to your solution.
  2. Update all “Export Field Contents” script steps to reference a new global container field. This script step is used to export files in the UTF-8 with BOM file type. I’m currently working on a new tool that doesn’t require this step, so stay tuned for our next blog about add-ons.
  3. Customize the variables where indicated.

Deploying the add-on on user machines:

  1. Run the “Save as add-on” script where you want to deploy the add-on. The script will save the FileMaker file on the local machine and modify its descriptive information. This works on local and hosted files.
  2. Restart FileMaker to see the changes in the add-on’s description, as prompted by the dialog box that comes up once the save is completed.
  3. Install the add-on in the target FileMaker solution.
Custom descriptive information of an add-on written through a FileMaker script

Warning

Installing add-ons can break your solution. They can also contain malicious code that is capable of leaking data from a database. Please review the code in add-ons thoroughly before installing them. Steven Blackwell and Stephen Dolenski published a write-up on this subject.

Reach out to sales@app.works if you need assistance with the technique detailed above.

fmLog

The scripts mentioned in this blog post can be found in our awesome and free logging module, fmLog: https://app.works/product/fmlog-2-1-add-on/