Changes Dictionary

Examples of what the changes dictionary looks like for a few ION Action targets.

In general, the best practice is to use as much information as possible from the context you define, which always represents the “after” state, when writing your rules.

For example, including status in your context ensures you cannot transition into that status without meeting the required conditions. An ION Action written on target ISSUE event UPDATE will show status as IN PROGRESS if status is included in the context and you just move the issue from PENDING to IN PROGRESS.

However, there are times when it is beneficial to look at what exactly has changed. The changes dictionary allows you to track both before and after states. This is useful for controlling transitions, validating updates, or detecting changes to specific attributes.

Access the Changes

To access the changes dictionary you can use statement like the following in your code.

Please use Python coding best practices when writing ION actions. This is simply meant as a helpful guide. Example: (context.get('changes', {}).get('procedures', {}).get('status', {}).get('new') == 'in_review’)

You will notice that fields within the changes dictionary are all snake_cased in the examples that follow.


Issues – Update

The changes dictionary for Issues updates captures modifications to steps, attributes, statuses, approvals, and root cause conditions.

Note: This is only an example of what the changes dictionary can contain. It is not a complete list of all possible changes.

'changes': {
  'issues': {
    'must_close_by_run_step_id': {'new': 2116, 'old': None},
    'status': {'new': 'in_progress', 'old': 'pending'},
    'cause_condition': {
      'new': [
        {'id': '71e5a1db-f3d3-4815-9965-3e5af6dba303', 'type': 'p', 'children': [{'text': 'fix me. Content in the main issue section updated'}]},
        {'id': '4a84a6af-d02b-44ac-a59c-26c083cd00e5', 'type': 'p', 'children': [{'text': ''}]}
      ],
      'old': [
        {'id': '71e5a1db-f3d3-4815-9965-3e5af6dba303', 'type': 'p', 'children': [{'text': 'fix me'}]},
        {'id': '4a84a6af-d02b-44ac-a59c-26c083cd00e5', 'type': 'p', 'children': [{'text': ''}]}
      ]
    }
  },
  'issuesAttributes': {
    'MAX_INVENTORY': {'new': 10, 'old': None},
    'Issue Origin': {'new': 'Engineering', 'old': None}
  },
  'issueApprovals': {},
  'issueApprovalRequests': {
    'status': {'new': 'approved', 'old': 'pending'}
  },
  'entities': {}
}

PartKitInventory – Create

When installing inventory onto a kit, the changes dictionary captures both inventory status and kitting quantity.

Note: This is only an example of what the changes dictionary can contain. It is not a complete list of all possible changes.

'changes': {
  'partsInventory': {
    'status': {'new': 'kitted', 'old': 'available'},
    'quantity_kitted': {'new': 1, 'old': 0}
  },
  'partKitInventories': {}
}

PartKit – Update

PartKit updates track team assignments, delivery location changes, and kit-level attributes.

Note: This is only an example of what the changes dictionary can contain. It is not a complete list of all possible changes.

'changes': {
  'userSubscriptions': {},
  'partsKits': {
    'assigned_team_id': {'new': 2, 'old': None},
    'delivery_location_id': {'new': 19, 'old': None}
  },
  'partKitAttributes': {
    'Date Kitted': {'new': '2025-09-08T07:00:00', 'old': None}
  }
}

Inventory – Update

Inventory updates capture cost changes, lot tracking, status/location transitions, and attribute updates.

Note: This is only an example of what the changes dictionary can contain. It is not a complete list of all possible changes.

'changes': {
  'partsInventory': {
    '_cost': {'new': 20, 'old': None},
    'status': {'new': 'unavailable', 'old': 'available'},
    'lot_number': {'new': 'Lot Test 123', 'old': None},
    'location_id': {'new': 19, 'old': 67},
    'origin_mbom_id': {'new': 412, 'old': None},
    'is_location_available': {'new': False, 'old': True}
  },
  'partsInventoriesAttributes': {
    'Pedigree': {'new': 'Tier 2', 'old': None},
    'mass': {'new': 200, 'old': None}
  }
}

Procedure – Update

Procedure updates track both status changes and procedural attributes.

Note: This is only an example of what the changes dictionary can contain. It is not a complete list of all possible changes.

'changes': {
  'procedures': {
    'status': {'new': 'in_review', 'old': 'draft'}
  },
  'proceduresAttributes': {
    'Responsible ME': {'new': 962, 'old': None}
  }
}

Last updated

Was this helpful?