Open MercatoDocsSearch docsAPI reference

User guide

Business Rules

Use a business rule when a condition should produce a repeatable decision or action. Inspect the execution log to see which rule ran and why.

The Business Rules Engine enables you to define, manage, and execute automated business logic without writing code. Rules are evaluated when specific events occur in your system, allowing you to enforce policies, validate data, calculate values, and trigger actions automatically.

What Are Business Rules?

Business rules are conditional statements that execute actions when certain criteria are met. They follow an "if-then" logic pattern:

Rules can be applied to any entity type in your system (Orders, WorkOrders, Customers, etc.) and triggered by lifecycle events (beforeCreate, afterUpdate, etc.).

Business Rules Overview

Business Rules navigation showing Rules, Rule Sets, and Execution Logs pages

Why Use Business Rules?

Centralized Business Logic Define business policies in one place instead of scattered throughout code. Rules are easier to audit, update, and maintain.

No-Code Automation Business users and administrators can create and modify rules without developer involvement. Changes take effect immediately.

Consistent Enforcement Rules are executed automatically and consistently across all channels (UI, API, integrations). No manual checks required.

Audit Trail Every rule execution is logged with input context, output, and performance metrics. Full visibility into decision-making.

Flexible and Powerful Complex logic with nested conditions, multiple actions, field comparisons, and special values (current date, logged-in user, etc.).

Key Concepts

Rules

A rule defines when and how business logic should be executed. Each rule has:

Rules List View Rules list page showing all defined business rules with filters and actions

Rule Types

Open Mercato supports five rule types:

Conditions

Conditions determine when a rule applies. They support:

Actions

Actions define what happens when conditions pass (success actions) or fail (failure actions):

Rule Sets

Rule sets group related rules together. They provide:

Execution Logs

Every rule execution is recorded with:

Logs are essential for debugging, auditing, and analytics.

Common Use Cases

Quality Control

Enforce quality standards automatically:

Approval Workflows

Route items for approval based on criteria:

Resource Management

Manage resource allocation intelligently:

Compliance and Safety

Enforce regulatory and safety requirements:

Customer Experience

Improve customer interactions:

Getting Started

  1. Create Your First Rule - Step-by-step guide to creating rules
  2. Build Conditions - Learn how to create complex conditional logic
  3. Configure Actions - Set up actions for success and failure scenarios
  4. Organize with Rule Sets - Group related rules together
  5. Monitor Execution - View logs and debug issues

Best Practices

Start Simple Begin with straightforward rules (single condition, single action) before building complex logic.

Test Thoroughly Use dry-run mode to test rules without side effects. Review execution logs carefully.

Use Descriptive Names Name rules and rule sets clearly to indicate their purpose (e.g., "Block WO Release Without Materials").

Set Appropriate Priority Higher priority rules execute first. GUARD rules should typically have high priority.

Monitor Performance Review execution logs for slow rules. Complex conditions or many rules can impact performance.

Version Control Use the version field to track changes. Consider effective dates for time-based rule changes.

Document Rules Use the description field to explain the business rationale and any special considerations.

RBAC Features

Access to Business Rules functionality is controlled by these features:

Contact your administrator to request access.

Next Steps

Previous: Execution Logs · Next: Rule Sets