Appearance
Business Logic screens
This page documents the Business Logic branch of the Explorer, apart from workflows (see Workflow Designer): Business Rules, Scripts, Expressions and Validations. Three of the other nodes, Approval Flows, Event Handlers, Scheduled Jobs and Notifications, are marked "coming soon" in the Explorer; scheduled work is covered in Jobs and scheduler and events in Events and automation.
Studio has three different kinds of "rule". They are easy to confuse:
| Kind | Where it is authored | What it does |
|---|---|---|
| Business rule (the rule artifact) | Business Logic > Business Rules | Runs an action chain when an event matches, with a priority band. Documented below. |
| Form rule | A form's Rules tab in the Form Designer | Shows, hides, requires or locks fields and sections based on other fields. See Form Designer. |
| Entity rule | A plugin's metadata/rules files, or the API (erp plugin op rule-create) | Runs on the server before or after a record is created, updated or deleted. See Reference: entity rule definition. |
Business Rules
Where to find it
Workspace > Business Logic > Business Rules. Page key rules. The list creates, edits, publishes and deletes rules; opening one opens the Rule Designer.
Key concepts
A rule is a named, versioned definition: an event pattern that says when it applies, an optional condition, optional watched fields, a scope that limits where it applies, a priority, and an action chain that runs when it matches. A rule has a draft and published versions like other artifacts, with autosave, crash recovery and a stale-draft guard.
Rule Designer, Properties
| Field | Description |
|---|---|
| Rule name | Required and unique. A duplicate is reported as duplicate-rule. |
| Event pattern | A dotted pattern such as department.onChange or order.*, or a catalog event. An invalid pattern is reported as invalid-event-pattern. |
| Catalog event | A picker over the platform's event catalog. Choosing one sets the event pattern. |
| Watched fields | Comma separated. The rule fires only when one of them actually changed. Empty means always. |
| Enabled | Switches the rule on or off without unpublishing it. |
| Suppress self-trigger | Prevents the rule's own actions from re-triggering it. Without it the designer warns possible-self-trigger. |
| Priority band | See below. |
| Custom priority and Priority override (deliberate out-of-band) | A priority outside the four bands. A priority that is not a band value and is not marked as a deliberate override is reported as out-of-band-priority. |
| Metadata version | Required to publish (missing-marketplace-metadata). Used by the marketplace. |
Priority bands
Rules run in priority order, lowest number first.
| Band | Priority | When it runs |
|---|---|---|
| Security | 1 | Before commit. Can veto the operation. |
| Validation | 5 | Before commit. Can veto the operation. |
| Business rule | 10 | After validation. |
| Notification | 100 | Asynchronously, after commit. |
Scope
The scope limits the rule to one block, form, page, workflow or role. Each dimension is a text field; a rule with no scope applies everywhere. A role scope matches when the acting user holds that role.
Condition
A condition builder works on event data. Bare names refer to the event's own data and are never flagged as unknown. Operators are the same as for workflow transitions.
Action chain
The chain is the list of steps the rule runs. Each step has a type, a configuration, and optional condition, retry and on-error settings. The step types and their fields are in How a screen is built. Steps can contain branches that are themselves chains. Plugin-provided action types appear with a raw JSON editor.
Typical step editors:
| Step | Fields |
|---|---|
| Run integration | What to run (a connector, or a flow that runs in the background), Type, Name, and input values (${form.field} sends a form value). |
| Call API | Request URL (map form values with ${form.field}), Method, parameters. |
| Set value | Target field (bare names write to the form scope; prefix to target another, for example page.total), Value kind (text or expression, boolean), Value (a literal or a ${...} reference). |
| Validate | Check expression and Failure message (shown as ${error.message} in on-failure chains; empty uses a default). |
| Show field | Field and Visible. |
| Navigate, Open dialog, Close dialog | Route; Dialog id (blank closes the most recent overlay); Page id and Open in. |
Problems panel
The panel shows the rule engine's own diagnostics. Errors block publishing; warnings do not.
| Code | Meaning |
|---|---|
missing-field, invalid-field | A required property is missing or has the wrong shape. |
invalid-event-pattern | The event pattern is not valid. |
invalid-condition | The condition is malformed. |
invalid-watched-fields | Watched fields are not a list of field names. |
invalid-actions | A step in the chain is invalid; the path points to the step (for example actions[0].config.url). |
duplicate-rule | Another rule has the same name. |
out-of-band-priority | Priority is not one of the bands and not marked as an override. |
missing-marketplace-metadata | Metadata version is missing. |
possible-self-trigger (warning) | The rule's actions may trigger the rule again. |
History
The History tab lists versions with a domain-aware diff.
API and CLI
/api/v1/authoring/rules (draft, publish, versions). erp artifact list|get|create|update|publish --type rules.
Scripts
Where to find it
Workspace > Business Logic > Scripts. Page key actions.
What a script is here
The Scripts folder lists shared actions: single action steps stored as their own versioned artifact so rules, forms and pages can reuse them. A shared action is exactly one step of an action chain, with all of its settings.
Action Designer
| Area | Description |
|---|---|
| Step editor | The same editor as the rule action chain: typed configuration for the built-in step types, a raw JSON fallback for plugin step types, the reliability settings (retry, onError strategies continue, stop, retry, compensate, rollback, ignore, custom), and nested branch chains. |
| Description | Free text. |
| Enabled | Switches the action on or off. |
| Metadata version | Required to publish. |
| Problems | Validation of the step against the real action registry. Publishing is blocked while errors exist. |
Every edit is one undoable change. Shared actions are versioned like other artifacts.
API and CLI
/api/v1/authoring/actions. erp artifact ... --type actions. Schema: Reference: action.
Expressions
Where to find it
Workspace > Business Logic > Expressions. Page key expressions. The Expression Library lists named expressions.
What it holds
A named expression is a reusable formula that rules, forms and pages can refer to by name. Expressions are saved compiled. They do not have a draft and publish lifecycle: saving is an upsert by name, the version increases only when the source changes, and Recompile moves an expression to the current engine version.
Fields
| Field | Description |
|---|---|
| Expression name | Saving under an existing name updates that expression. |
| Expression source | The formula. |
| Return type | Optional. Documentation, not enforcement. |
The list shows Name, Returns, Version (v<n>) and Engine (compiled or not compiled).
Saving
Compile & save first validates the source with the engine's own validator, using the rule vocabulary. Compile diagnostics are shown verbatim and an expression that does not compile is not saved. A successful save shows the version and the engine version it compiled against. Recompile is audited and records the new engine version.
Validations
Where to find it
Workspace > Business Logic > Validations. Page key validations.
What it shows
A read-only, workspace-wide list of every validation, gathered from the forms. Nothing is stored separately: each row is read from a form definition, and selecting a row opens that form in the Form Designer.
Columns
| Column | Description |
|---|---|
| Name | The field and rule, for example email required, or the rule id. |
| Type | Required, Pattern, Length, Min/Max Value, Unique for field constraints; Cross Field, Form or Field Rule for form-level validation rules. |
| Entity | The entity of the form. |
| Form | The form that defines it. |
| Status | Active or Inactive. |
Where validations are authored
Field constraints are set in the field's properties in the Form Designer. Form-level validations (for example a cross-field rule) are authored on the form's Validations tab. Reusable named checks (pattern, range, cross-field expression) are covered in Workflows, rules and validations.
Related
Workflow Designer, Form Designer, Business Logic, How the pieces fit together.
