Setyenv · Docs
  • English
  • Spanish
  • Chinese
  • Japanese
  • Arabic
  • German
  • French
  • Hindi
  • Indonesian
  • Italian
  • Dutch
  • Portuguese
  • Russian
  • Turkish

Business Rules

Server-side pre-save rules that validate records and trigger workflows. Business Rules are the automation backbone — they let you enforce data quality and react to record changes automatically.

Anatomy of a Business Rule

Each rule has:

PropertyDescription
EntityWhich entity this rule applies to
EQL filterWhen the rule fires. Supports CHANGES(field) and DIDNOTCHANGE(field) operators comparing pre-save vs post-save values
AbortIf true, the save is rejected with a custom message
MessageThe error message shown when the rule blocks a save (with locale support)
Applies oncreate, update, or both
WorkflowWhen abort=false, this workflow is dispatched after the save
Sort orderRules evaluate in ascending order; first matching abort rule wins

Example: prevent closing a ticket without a resolution

  • Entity: ticket
  • Filter: statusCHANGESto:closed^resolutionISEMPTY
  • Abort: true
  • Message: "You must enter a resolution before closing the ticket."

Example: notify on high-value deal

  • Entity: deal
  • Filter: amount>10000^ANDstageCHANGESto:won
  • Abort: false
  • Workflow: "Notify sales manager" (an existing WP-PFWorkflow workflow)

Workflow integration

When a non-aborting Business Rule matches:

  1. The record is saved normally
  2. pfm.<entity>.br_triggered event fires
  3. The linked workflow executes with the record data as trigger payload
  4. If WP-PFWorkflow is installed, the workflow is auto-created when you create the BR

Cross-plugin automation

When you create a Business Rule, pfm_business_rule_created fires → WP-PFWorkflow auto-creates a linked workflow draft. When the workflow is created, pfw_workflow_for_br_created fires back → PFM persists the workflow_id on the BR row. This means: create a BR → a workflow appears automatically, ready to customise.