fix(MOMFollowup): use proper workflow API in auto-escalation schedule…#6028
fix(MOMFollowup): use proper workflow API in auto-escalation schedule…#6028pjamsheer wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the scheduled mom_followup_reminder escalation logic to transition MOM Followup documents via the workflow system (instead of directly setting workflow_state), while also attempting to auto-fill a missing “reason for missed MOM” and improving error logging for failed escalations.
Changes:
- Switch escalation from direct
workflow_stateassignment toapply_workflow(...)for auditable workflow transitions. - Auto-populate
reason_for_missed_momwhen missing during auto-escalation. - Add try/except logging around each escalation attempt and temporarily elevate permissions for workflow actions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…d job Replace direct workflow_state assignment with apply_workflow to properly handle role validation and workflow conditions. Elevate to Administrator context and auto-populate reason_for_missed_mom field. Fixes: WorkflowPermissionError in mom_followup_reminder Co-authored-by: Copilot <copilot@github.com>
… restoration in reminder function Co-authored-by: Copilot <copilot@github.com>
… with role bypass Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…d job
This pull request improves the
mom_followup_reminderfunction inmom_followup.pyto make the MOM follow-up escalation process more robust and auditable. The main changes include using the workflow system for state transitions, auto-populating missing reasons for escalation, temporarily elevating permissions to perform workflow actions, and adding error handling and logging.Enhancements to MOM Follow-up Escalation:
apply_workflowto transition the document state instead of directly setting theworkflow_state, ensuring proper workflow tracking and auditability.Error handling improvements: