79.1 F
Monday, October 2, 2023

User-Defined Custom Business Logic in Claris FileMaker


Business rules inevitably evolve over time. When they do, it’s important that FileMaker users are able to adjust their application quickly and easily to keep up. The best way to do this is to allow users to modify and define what information FileMaker is presenting them with and how it should be presented using business logic. Let’s demonstrate how to enable users to define business rules.

When To Use User-Defined Logic

One use case for user-defined business logic is to give users a way to specify what information they want to be synced between a local copy of a file and a hosted version of the same file. In a file with a lot of tables, it may not be necessary to sync data between the two for every table. However, as the system grows – either through the addition of new tables or the necessity to sync data from previously excluded tables – it becomes difficult to add logic to scripts to account for such changes.


To demo this functionality, we will use a FileMaker application for entering order information. You can download the demo file (located at the bottom of this article) and follow along. 

Filemaker user defined custom business logic opening screen

Click on the plus sign in the top left corner of the tab control. This brings up a card window that will allow users to select which layouts to include.

Filemaker user defined custom business logic add layouts button

In the card window, click the refresh icon in the top right to initialize the layout selector with the layouts currently found in the file. Click on the layout you want to include. In this case, we want to use “order”. It should already be selected and will appear in the Sync Layouts tab. 

Filemaker user defined custom business logic layout selector

The next step is to select the primary key for that layout. This field is a dropdown list that works off a value list. The value list is a calculation field that is set to a global variable.

Filemaker user defined custom business logic value list

The value for this global variable is defined in a script parameter that is a script trigger on the primary key selector field. The script itself does nothing, but the script parameter is a let statement that defines the global variable we use for the value list, so it will update dynamically as we click into each portal row.

Filemaker user defined custom business logic calculation
Filemaker user defined custom business logic script parameter

Clicking into the limit criteria box brings up a card window allowing the user to define the logic that the system will use to limit the return data during syncs or, in the case of this demo, finds. 

Filemaker user defined custom business logic limit criteria

**Important notes about the limit criteria: Users are only able to select fields that exist on the layout. They can also type into the box instead of using the insert drop-downs if they prefer.

Filemaker user defined custom business logic limit criteria notes

The two drop-downs to the left of the edit box contain a list of operators that users can add to modify the query and the list of fields they can select from. After adding their logic, users can view what the JSON data will look like for their query by pressing the preview query button. The run query button is for demonstration purposes and simply runs a find with the given parameters.

Filemaker user defined custom business logic json results

How the Logic Works

This solution uses escape characters to denote items as fields or functions and uses Evaluate to determine the function’s value at runtime. To parse the users specified criteria, there is a calculation that builds the JSON data block using a while loop. “[ ]” are used to encapsulate a field name if it has spaces or underscores, “#{ }” is used to wrap a function that needs to be evaluated, “” is used to perform OR requests. “Omit” marks that section of the query as an omit section.

Filemaker user defined custom business logic while loop

We then use a custom function to evaluate any functions before performing the query.

Filemaker user defined custom business logic function


User-defined logic is a powerful tool that enables end users to adapt quickly to ever-changing markets and rules. This functionality also allows your system to be much more flexible and will lead to less time spent updating scripts to add in new criteria, enabling you to manage and view these settings from one layout. These settings can be used to send sync queries to a hosted app with the data API or, as we demonstrated in this article, to perform dynamic finds.

If you would like to learn more about integrating user-defined logic in your Filemaker application or how adding it into your system can help your business run better, contact our team at DB Services and we’ll gladly help you find the right solution for your business.

Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.

Download the User-Defined Custom Logic File

Please complete the form below to download your FREE FileMaker file.

DB Services
DB Serviceshttps://dbservices.com
FMT's PREFERRED DBServices expert developers are able to tackle any project, whether you need guidance on a small project or want to outsource a large initiative to us. You will work with a reliable team that has the talent and experience to solve any challenge, and a culture designed around excellent customer service and building lasting relationships. Our mission is to make organizations more efficient and effective through digital transformations while offering superior service and exceptional expertise.
crm erp


More like this

DayBack Calendar for FileMaker – SalesForce

Calendar Plugin. If you're looking for a powerful and...

Using the Salesforce API in Claris FileMaker

Using the Salesforce API in Claris FileMaker SeedCode’s Ann Kiser...

codeLive: How to Leverage MuleSoft APIs across Salesforce and Slack

Designing an API in MuleSoft that we can use...

codeLive: How to Write Effective Prompts for Einstein for Developers

Crafting effective prompts is key to getting accurate AI...