Cancels and removes previously scheduled workflows that are no longer needed, preventing future executions and cleaning up resources.
The cancelScheduledFlow function allows you to stop and remove previously scheduled workflows that are no longer needed. This function is essential for cleaning up one-time schedules after completion or canceling recurring schedules that are no longer required.
Cancel and remove scheduled workflow executions, preventing future runs of the specified scheduled flow while maintaining proper resource management and system cleanliness.
Essential Cleanup: This function is particularly useful for creating self-managing workflows that can clean up their own schedules when tasks are completed or conditions change, preventing unnecessary resource usage and maintaining a clean scheduling environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
| target_flow_id | string | Optional | Specific scheduled flow ID to cancel |
| self | boolean | Optional | If true, cancels the current workflow's own scheduled flow |
The cancelScheduledFlow function returns a simple completion confirmation:
Parameter Note: You must provide either target_flow_id or set self to true. Both parameters are optional individually, but one must be specified for the function to work.
Cancel the schedule created by the current workflow execution
Primary Use Case: Use when the current workflow wants to cancel its own scheduled execution, typically at the end of a one-time scheduled task
Cancel a specific scheduled flow using its unique ID
Primary Use Case: Use when you have the specific scheduled flow ID and want to cancel that particular schedule from any workflow
Using handleConditional to determine when to cancel schedules based on task completion:
Workflows that automatically clean up their own schedules after completing their purpose:
Set up monitoring that automatically stops when conditions are met:
Proper cleanup of one-time schedules after completion:
Managing schedules based on external conditions and data changes:
Maintain system efficiency by properly cleaning up unnecessary scheduled flows.
Implement intelligent schedule management based on changing conditions and requirements.
Properly manage the entire lifecycle of scheduled flows from creation to completion.
Prevent errors and ensure reliable schedule cancellation operations.
These functions work together with cancelScheduledFlow for comprehensive schedule management and automation: