diff --git a/src/dispatch/case/flows.py b/src/dispatch/case/flows.py index 0736474f4cfa..51dee63b5507 100644 --- a/src/dispatch/case/flows.py +++ b/src/dispatch/case/flows.py @@ -744,6 +744,15 @@ def common_escalate_flow( db_session.add(incident) db_session.commit() + # we run the incident create flow in a background task + incident = incident_flows.incident_create_flow( + incident_id=incident.id, + organization_slug=organization_slug, + db_session=db_session, + case_id=case.id, + ) + + # we link the case to the incident case.incidents.append(incident) db_session.add(case) db_session.commit() @@ -755,14 +764,6 @@ def common_escalate_flow( case_id=case.id, ) - # we run the incident create flow in a background task - incident = incident_flows.incident_create_flow( - incident_id=incident.id, - organization_slug=organization_slug, - db_session=db_session, - case_id=case.id, - ) - # we add the case participants to the incident for participant in case.participants: # check to see if already a participant in the incident