# CancelProcessActivity ## Overview Cancels a specified Process Activity , handling employee check-outs automatically if configured. The service validates that the Process Activity is in a state that allows cancellation, performs any necessary employee check-outs, terminates the active checklist instance if applicable, and sets the Process Activity state to *Canceled*. ## Action Groups * Orchestration.IndEqManagementOrchestration.CancelProcessActivity.Pre * Orchestration.IndEqManagementOrchestration.CancelProcessActivity.Post ## Input Object | Name | Type | Description | | --------------- | :------------------: | ------------------------------------ | | ProcessActivity | IndEqProcessActivity | The Process Activity to be canceled | ## Output Object | Name | Type | Description | | --------------- | :------------------: | ------------------------------------------------ | | ProcessActivity | IndEqProcessActivity | The updated Process Activity in *Canceled* state | ## Pre Conditions * The input *ProcessActivity* must not be null and must exist. * The *ProcessActivity* must be in one of the following states before cancellation: *Open*, *In Progress*, or *Paused*. ## How it works 1. Validates the input is not null and loads the full *ProcessActivity* entity. 2. Checks that the *ProcessActivity* is in a cancellable state (*Open*, *In Progress*, or *Paused*). If not, it throws an exception. 3. Checks if there are any employees currently checked in to the Process Activity . 4. If employees are checked in and the Process Activity definition allows: - Auto check-out on close is enabled: performs automatic check-out for all checked-in employees. - Otherwise, cancellation proceeds only if no employees remain checked in; if employees remain checked in, the Process Activity cannot be terminated. 5. If the Process Activity cannot be terminated due to checked-in employees, it terminates the active checklist instance (if any) to keep dependencies consistent. 6. Sets the system state of the Process Activity to *Canceled*. 7. If allowed, terminates the Process Activity only when there is no checklist associated to the Process Activity to finalize cancellation. 8. Returns the updated Process Activity in the output. ## Assumptions * Employee check-in and check-out states are managed consistently. * Process activity termination and checklist termination handle all necessary cleanup. * Role and permission checks for cancellation are handled externally or before calling this service. * Application context flag *IndEqTerminateDependenciesOnPATermination* is used to control side effects during termination.