Open MercatoDocsSearch docsAPI reference

User guide

Action Builder

An action describes what happens after a rule evaluates. Configure the success and failure paths separately, then test the message with representative record values.

Actions execute based on condition results:

Action Types

ActionPurposeConfigurationExample
ALLOW_TRANSITIONAllow state transition (GUARD rules)NoneAllow work order release
BLOCK_TRANSITIONBlock transition + error messagemessage"Materials not available"
LOGWrite to execution logslevel (info/warn/error/debug), message"Order {{orderId}} approved"
SHOW_ERRORDisplay error to usermessage"Exceeds credit limit"
SHOW_WARNINGDisplay warning to usermessage"Below minimum quantity"
SHOW_INFODisplay info to usermessage"Submitted for approval"
NOTIFYSend notificationsrecipients, messageRecipients: [email protected]
SET_FIELDUpdate entity fieldfield, valuefield: status, value: "APPROVED"
CALL_WEBHOOKHTTP request to external URLurl, method, payloadPOST https://api.example.com
EMIT_EVENTEmit domain eventeventName, payloadEvent: order.approved

πŸ’‘ GUARD rules: Use BLOCK_TRANSITION as failure action to prevent operations.

Message Interpolation

Use {{field}} syntax for dynamic values:

Success vs. Failure Actions

Success (conditions true):

Failure (conditions false):

Example:

Conditions: orderTotal > 10000
Success: SET_FIELD status="PENDING_APPROVAL", NOTIFY approver
Failure: SHOW_INFO "No approval needed"

Action Sequencing

Actions execute top-to-bottom. Use arrow buttons to reorder.

Order matters:

Example: LOG β†’ SET_FIELD β†’ SHOW_INFO β†’ NOTIFY β†’ EMIT_EVENT

Building Actions

  1. Click Add Action in Success/Failure section
  2. Select action type
  3. Fill configuration fields
  4. Use arrow buttons to reorder
  5. Click trash icon to delete
  6. Click Show JSON to view raw structure

Validation: System checks required fields, field paths, URLs, JSON syntax, and interpolation.

Action Builder Interface Action builder showing success and failure actions with configuration forms and reordering controls

Common Patterns

Approval Workflow:

Success: SET_FIELD status="PENDING_APPROVAL", NOTIFY approver, SHOW_INFO

Guard with Feedback:

Failure: BLOCK_TRANSITION, SHOW_ERROR, LOG error, NOTIFY admin

Audit Trail:

Success: LOG "{{operation}} by {{user.email}}", SET_FIELD lastModified

External Integration:

Success: LOG, CALL_WEBHOOK, EMIT_EVENT entity.synced

Best Practices

Troubleshooting

IssueCheck
Action not executingCorrect section (success/failure), conditions evaluating properly, execution logs
Interpolation failingField path syntax, field exists, execution logs for undefined values
Webhook failuresURL accessible, authentication, endpoint logs, JSON syntax
Field not settingField path correct, field writable, value type matches

Next Steps

Previous: Autopay Payment Gateway Β· Next: Condition Builder