ION Actions Best Practices | ION Factory OS 2.0

[This manual has been deprecated.

Read the new manual](https://docs.firstresonance.io/)

For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overview

The Ion Actions engine enables powerful automation and business logic within ION by allowing users to define rules that respond to object events such as Work Order updates, Issue creation, or Part changes. Rules are written in Python and executed dynamically based on event triggers.

This document outlines best practices for writing, testing, and managing Ion Action rules. Following these guidelines will help ensure reliable behavior, maintainability, and consistency across your automation logic.


1. Rule Execution and Behavior

Chained Execution

When multiple rules target the same object and event type (for example, Issues Update), they are chained together and executed sequentially. The execution order is determined by internal rule IDs, which are not user-controlled and may vary. Because of this, rule order should not be relied upon.

Avoid Top-Level return Statements

If a return statement is used at the top level of a rule, the Ion Actions engine will stop executing that rule and all subsequent rules in the chain. This can lead to unintended skipping of logic defined in other rules that share the same event target.

Example (Problematic):

if issue.status == "Closed":
    return  # ❌ This stops execution of all following rules for this event

Use Nested Returns Instead

To safely control flow within your rule without affecting other chained rules, scope your return statements within functions or conditionals. This allows the Ion engine to continue executing subsequent rules.

Example (Recommended):

if issue.status == "Closed":
    def handle_closed_issue():
        # Logic specific to closed issues
        return "Handled closed issue"  # ✅ Nested return affects only this function

handle_closed_issue()

Additional Recommendations


2. Rule Development and Deployment

Version Control and Collaboration

Deployment Process

Governance and Documentation