- Actions page: a dedicated UI in ION with a built-in code editor for creating and managing actions.
- GraphQL API: direct rule creation, update, and deletion for programmatic deployment.
Common patterns
These are the high-value validation rules most customers set up first:- Required fields on creation: a quality issue must have a defect type and a major subsystem before it can be saved.
- Block a status transition: an issue can’t move to In Review until it has an assignee.
- Approval gate: a procedure can’t be released without the required approval.
- Block run closure if the aBOM is incomplete.
Before you start
Actions must be enabled at the organization level before any action can fire. Confirm the setting in the built-in GraphiQL editor:- In ION, select GraphQL in the sidebar to open the GraphiQL editor.
-
Run this query to check the current setting:
-
If
enabledisfalse, an admin can turn it on with theupdateOrganizationmutation. See the API reference for the full mutation shape.
Action fields
An action is defined by these parts. Title, target, and event are form fields; context and code are tabs in the built-in editor.- Title: identifies the action and appears in its toast notification and the audit log.
- Target: the object to watch, such as Run, Issue, or Procedure, chosen from a dropdown.
- Event (labeled Event Type in the editor): when the action runs against the target: Create, Update, or Delete.
- Context: a GraphQL query for the data your code needs, such as the target’s fields, related records, and user roles. Your code reads from this data.
- Code: a Python script that runs when the event fires. It reads the context and decides the outcome: raise
ValidationErrorto block the change with a message, raiseValidationWarningto warn without blocking, or do neither to allow it. The code is read-only; it can’t write data or call external systems.
A validation action blocks by design: when the code raises
ValidationError, the change is rejected with the message you set. Use this for required-field and approval-gate actions. To surface a message without blocking, see Create a warning action below.More on context
Alongside the target’s data, the context also providescurrentUser (the acting user’s email, roles, and teams) and a changes object describing what the event modified. It’s keyed by the camel-cased table name, then by field, and each entry holds { "new": ..., "old": ... }, with the old value null on a create and the new value null on a delete. Field names are snake-cased, and attribute tables are keyed by the attribute’s name.
A changes object for a procedure update can look like this:
Issue update
Issue update
Inventory update
Inventory update
Part kit update
Part kit update
changes to branch on what actually changed rather than the final state. For example, to act only when a procedure’s status changes to released, rather than on every procedure update:
When two actions on the same target and event filter the same field differently in their context (for example, both query
Attributes(filters: {...}) with different keys), the merged query fails. Give each filtered field an alias, such as deptAttr: Attributes(filters: {key: {eq: "Department"}}), and reference the alias in your code.Create an action
- In ION, open Actions.
- Select Create Action.
- Set the title, target, and event.
- In the context, query the data your action needs, then write the code in the built-in editor. See the fields above for what each one does.
- Save the action.
createRule mutation. See the API reference for the mutation shape, and the Examples for working action configurations.
Create a warning action
A warning action is the non-blocking version of a validation action: the change still saves, a warning message is shown alongside the result, and the warning is recorded in the execution logs. Use a validation action for hard requirements, such as a missing required field or an approval gate, and a warning action for soft ones, such as a skipped recommended step or an out-of-range but allowed value. To make an action warn instead of block, raiseValidationWarning instead of ValidationError. Keep ruleType: VALIDATION; the exception type drives the behavior.
extensions.warnings and appear as a non-blocking toast.
![Orange warning toast in the bottom-left of the New ION interface reading: 'Warning — [Rule 93] Warn when a Run Step is completed with open issues. This Run Step was completed while it still has open issues. Confirm the issues don't need to be resolved first.'](https://mintcdn.com/firstresonance/3YHPQuEzl4qOwG1I/images/ion-actions/warning-actions-toast-new-ion.png?fit=max&auto=format&n=3YHPQuEzl4qOwG1I&q=85&s=8d57d9b386ca03cebacb6112f009de4f)
Edit an action
- In ION, open Actions.
- Select the action to open its detail page.
- Update the title, target, context, or code. The title appears in the action’s error and toast messages, so keep it meaningful.
- Select Save.
updateRule mutation. See the API reference for the mutation shape.
Enable or disable an action
In the Actions list, select one or more actions with the checkboxes, then enable or disable them. A disabled action isn’t evaluated, which lets you stage an action before turning it on in production.Share an action across environments
To copy an action to another environment, open it and select Share. ION generates the action’screateRule mutation; copy it and run it in the target environment’s GraphiQL editor to recreate the action there.
Delete an action
- In ION, open Actions.
- Find the action you want to remove.
- Delete it and confirm. To remove several at once, select them with the checkboxes and delete them together.
deleteRule mutation. See the API reference for the mutation shape.
How the code is structured
When an event and target combination matches several actions, those actions are squashed together at run time. Squashing merges both the code and the requested context so every triggered action runs with the data it needs. For example, two actions are both configured with eventCREATE and target RUNS:



ValidationError: a class defined in every execution log. If an action raises it, the action’s ID and name are injected into the code so it’s clear which action caused the failure.run_rule: wraps each triggered action into one executable unit and runs them in sequence, with validation actions before warning actions so a block takes precedence.ctx: the combined context for all squashed actions. Each action declares the fields it needs, and squashing merges them into one context object.
dueDate and action 240 requests procedureId, so the resulting context contains both:

Related
- View action execution logs to inspect and debug an action run
- Example actions for working action configurations