> For the complete documentation index, see [llms.txt](https://docs.buzzy.buzz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.buzzy.buzz/developing-and-extending-buzzy/buzzy-rest-api/datatable-rules.md).

# Datatable Rules

Datatable Rules perform actions such as sending notifications, calling external APIs, locking rows, or logging events when datatable rows and fields change.

If you need to move data into or out of Buzzy, use the current integration surfaces instead of the deprecated import/export pages:

* [REST API Reference](/developing-and-extending-buzzy/buzzy-rest-api/rest-api.md) for external systems that need authenticated CRUD access.
* [NodeJS API Client](/developing-and-extending-buzzy/buzzy-rest-api/nodejs-api-client.md) for server-side JavaScript integrations.
* [Buzzy Functions](/the-building-blocks/buzzy-functions-and-constants/buzzy-functions.md) for server-side app logic and integration code.
* [Buzzy Custom MCP](/the-building-blocks/mcp/buzzy-custom-mcp.md) when MCP clients should manipulate app-specific data through enabled tools.

Now back to the topic of Database Rules: In your Datatable, you can set a rule to issue events each time it accesses a row or field. At design time, you set which activities are to handle the events. These events include:

* Submit - a new row is created
* Delete - an existring row is deleted
* Click Filter - Allows a target Datatable to be filtered based on row value. More information can be found in [Datatable to Datatable Relationships](/the-building-blocks/datatables-fields-and-data/datatable-to-datatable-relationships.md)
* Clicked - If a Button field is selected than the event is processed. For other field types (e.g. Select) it is when data is edited.
* Edited - a field value has changed

When a field is selected, only clicked and edited are available.

Processing can take place as:

* Notify - Sends a message to a predfined participant of the Buzz
* Send JSON - Sends a REST call with a JSON document to the 3rd party
* Toggle lock/unlock - Either prevents or grants access to the recordor field
* Log Event - Captures an Event detail record. A valid JSON document is input and the resulting data is logged.
* *Others* - beta functionality, contact support for more information.

<div align="left"><img src="/files/LnvfUK1XzR07RkEA8HAG" alt=""></div>

To access a Microapp Rules definition, select the Microapp Properties, followed by Advanced and then Rules tab.

<div align="left"><figure><img src="/files/e62MPPhvl3vfAOaeMBLM" alt=""><figcaption></figcaption></figure></div>

Select the Entity, either the entire row or a field in the row.

<div align="left"><img src="/files/Y5Cb0RtmQPYdLuFTvuv1" alt=""></div>

Now select the event (condition) and enter the appropriate information

<div align="left"><img src="/files/T12cPk1I0MHrD5lhdVHH" alt=""></div>

Most actions have example text in the fields.

## Notify action options

The new notification rule API adds delivery controls to the `Notify` action:

* `Channel`: choose `Default`, `Push Only`, or `In-App Only`
* `Message`: optional text, with support for merge placeholders like `{{{|First Name}}}`
* `Badge Count`: optional JSONata formula that resolves to a number

### Channel behavior

* `Default` creates an in-app notification and also sends push delivery when available.
* `Push Only` skips the in-app notification record and sends push delivery only.
* `In-App Only` creates an unread in-app notification without sending push.
* If you choose `Push Only` and leave `Message` blank, Buzzy sends a badge-only push update with no visible push message.

### Badge Count formula

Use the `Badge Count` field when you want the app badge number to be calculated dynamically from the row being processed. The formula is evaluated as JSONata and should return a number. Invalid or blank results are ignored.

This is especially useful for counters such as unread tasks, overdue approvals, or outstanding alerts that should be shown as a specific badge value instead of simply incrementing the unread count.

***
