# Business Logic

Separating Concerns

### DRY - Don't Repeat yourself

Write scripts that can be called from both FM Client and BF Web apps equally. This is a paradigm change for most FileMaker developers.

Consider a workflow that creates a new record when a user initiates some action like clicking a button.

#### Traditional FileMaker Pseudo code

* \[Button Clicked] - Run script "Create Record"

### Validation Best Practices

Do not assume data has been validated. **Anything that comes from the client (browser) can be hacked.** If you are using the database native field validations (not empty, unique etc) then make sure you trap for errors on commit. These errors should be echoed back to the client in the form of a [modal](/v1/reference/actions-processor/actions_overview/showmodal.md) or [alert](/v1/reference/actions-processor/actions_overview/showalert.md).


---

# 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.klai.studio/v1/usage/design-patterns-and-debugging/business-logic.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.
