# Datatable Rules

Datatable Rules allow you to call perform actions liking sending notifications (email/push) and calling external API's. Alternatively, If you're looking import external data from a REST API, Google Sheet or CSV file, into you Datatable please see[ importing data from another data table](https://docs.buzzy.buzz/the-building-blocks/datatables-fields-and-data/import-data-from-datatable),[ importing data from a URL](https://docs.buzzy.buzz/the-building-blocks/datatables-fields-and-data/importing-data-from-a-url) and i[mporting data from a file](https://docs.buzzy.buzz/the-building-blocks/datatables-fields-and-data/importing-data-from-a-text-file)

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](https://docs.buzzy.buzz/the-building-blocks/datatables-fields-and-data/datatable-to-datatable-relationships)
* 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="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FoZzXbLlQl6tfFv4q2KFM%2Frules4?alt=media" 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="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FKdWfEr7ttt1FImMPIRp1%2Frules1?alt=media" alt=""><figcaption></figcaption></figure></div>

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

<div align="left"><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FALnpoTFp1Bb9ca5KETHK%2Frules2?alt=media" alt=""></div>

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

<div align="left"><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FkcCg7BDtEYgiLSoA6fiO%2Frules3?alt=media" 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.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.buzzy.buzz/rest-api/buzzy-rest-api/datatable-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
