update_application_code

Admin-only MCP tool.

Write the shared code library that belongs to an application. To write one of the procedures that run at moments in the life of an entry in a form, use update_form_code instead.

The code you send replaces the library completely. It is not added to what is there. Call get_custom_code first and if you are adding to existing logic, include the existing code in what you send. Sending an empty string removes the library altogether.

This code is not wrapped in anything. The file is included as it stands on every page of the application, so begin it with a <?php tag. This file is usually nothing but function declarations - helpers that the form procedures call, or that derived value elements reference in their formulas, etc. This provides a common place for shared application logic to exist. Anything that this file prints out / echos to screen, is included in the DOM as is, so in extreme cases it can be useful for special scripts or style overrides, but use that capability sparingly!

For details of the functions and formulizeDataHandler methods available to this code, use the get_documentation tool, if it is available.

There is no syntax checking when you save, and an error here affects every page of the application rather than one form, so re-read what you wrote before finishing.

Properties

Property Type Required? Description
application_id integer Required

Required. The id of the application. Use the list_applications tool to find application ids.

code string Required

Required. The PHP for the library, beginning with a <?php tag. Send an empty string to remove it.

← Back to the MCP reference