Canceling a workflow Canceling a workflow stops the workflow from executing and sets the workflow context State to Canceled. About this taskCanceling a workflow attempts to stop the workflow gracefully by injecting a cancel command into the workflow engine.To cancel an active workflow: Procedure Navigate to Workflow > Active Contexts. Select a workflow context record. Select the Cancel related link. A confirmation window appears. Click OK. The Wait for Cancel window appears. The workflow engine attempts to cancel the workflow gracefully. If the workflow does not respond to the cancel command, the Force Cancel window appears. Click Force cancel to interrupt the thread the workflow is actively executing or click Continue waiting to continue waiting for the workflow to cancel gracefully. Warning: Whenever possible, allow a workflow to cancel gracefully. Forcing a workflow to cancel can leave related workflows and scripts in an unresolved state. You can use an on-cancel script to clean up unresolved artifacts from a cancelled workflow. Cancel a workflow with the cancelContext(context) scriptTo cancel an executing workflow, you can use the cancelContext(context) script. This script can be useful in cases where a workflow must be canceled in response to an event or where a user must manually cancel a workflow.Defining an on-cancel scriptCanceling a workflow can leave records or scripts in an unresolved state. For example, canceling a service catalog workflow may leave catalog items in the requesting user's cart. An administrator can specify an On-cancel script that runs when the workflow transitions to the Canceled state. This script can notify users, log information, or resolve the state of any scripts run within a workflow activity. The sys_id of the workflow context is available in this script using the context_sys_id variable.