From 2667e44830ed2def867c92c161f5ecd0c2310f17 Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Tue, 3 Feb 2026 16:39:32 +0100 Subject: [PATCH] Auto-commit local changes before build (2026-02-03 16:39:32) --- .last-branch | 2 +- .../app/integrations/autotask/client.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.last-branch b/.last-branch index 00b87aa..a370cad 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260203-10-autotask-resolution-field-aliases +v20260203-11-autotask-resolution-get-put-required-fields diff --git a/containers/backupchecks/src/backend/app/integrations/autotask/client.py b/containers/backupchecks/src/backend/app/integrations/autotask/client.py index 3622f76..ae786bd 100644 --- a/containers/backupchecks/src/backend/app/integrations/autotask/client.py +++ b/containers/backupchecks/src/backend/app/integrations/autotask/client.py @@ -605,9 +605,27 @@ class AutotaskClient: } def _get_first(ticket_obj: Dict[str, Any], keys: list[str]) -> Any: + """Return first matching value for any of the given keys. + + Autotask field casing / suffixes can vary by tenant and API surface. + We therefore try direct lookups first and then fall back to a + case-insensitive scan of the ticket payload keys. + """ + if not isinstance(ticket_obj, dict): + return None + + # Direct lookups (fast path) for k in keys: if k in ticket_obj: return ticket_obj.get(k) + + # Case-insensitive fallback + lower_map = {str(k).lower(): k for k in ticket_obj.keys()} + for k in keys: + lk = str(k).lower() + if lk in lower_map: + return ticket_obj.get(lower_map[lk]) + return None stabilising_fields = list(field_sources.keys())