# CheckOutProcessActivity ## Overview Checks out one or more employees from a given Process Activity. This includes calculating and storing the check-in duration, handling auto-pause behavior if applicable, and terminating the Process Activity when appropriate. ## Action Groups * Orchestration.IndEqManagementOrchestration.CheckOutProcessActivity.Pre * Orchestration.IndEqManagementOrchestration.CheckOutProcessActivity.Post ## Input Object | Name | Type | Description | | --------------------------------- | :------------------------------------: | ------------------------------------------------------------------------- | | ProcessActivityEmployeeCollection | IndEqProcessActivityEmployeeCollection | (Optional) Collection of employee-Process Activity relations to check out | | ProcessActivity | IndEqProcessActivity | (Optional) Process Activity from which the employee should be checked out | | Employee | IEmployee | (Optional) Employee to check out from the specified Process Activity | | Trainer | IEmployee | (Optional) Trainer to associate with the check-out operation | ## Output Object | Name | Type | Description | | --------------------------------- | :------------------------------------: | ----------------------------------------------------------------- | | ProcessActivityEmployeeCollection | IndEqProcessActivityEmployeeCollection | The collection of checked-out employee-Process Activity relations | ## Pre Conditions * At least one of the following must be provided: * *ProcessActivityEmployeeCollection* with valid items, OR * A valid *ProcessActivity*. * *EnableCheckIn* must be enabled in the Process Activity Definition for the given activity. * *Trainer* is optional and only used if provided. ## How it works 1. If *ProcessActivityEmployeeCollection* is provided, it is used as the list of employees to check out. 2. Otherwise, the service validates the provided *ProcessActivity* and retrieves the current user’s employee if *Employee* is not provided via input. 3. It then determines which employees are currently checked in for that activity. 4. For each employee being checked out: - Sets the *EndDate* to the current UTC time. - Calculates the duration based on the start and end time, and applies the weight. - Associates a *Trainer* if specified. - Validates that *EnableCheckIn* is enabled for the activity. - If the activity is *In Progress* and *AutoPause* is enabled, and this is the last checked-in employee, the activity is paused automatically. 5. Saves and terminates the *ProcessActivityEmployeeCollection* relations. 6. If the Process Activity is in *Closed* or *Canceled* system state, no employees remain checked in, and no checklist associated with the activity, the activity itself is terminated. ## Assumptions * All activities and employee relationships are preloaded and valid. * Configuration key *ConfigAutoPauseDefaultReason* exists and contains a valid pause reason name if *AutoPause* is triggered. * The context flag *PreventTriggerCheckOutProcessActivity* is respected in downstream logic to prevent recursive check-out loops. * The employee's weight is used to scale the duration.