---
id: object/codeunit/46858
type: object
title: Codeunit 46858 "BC14 Migration Status Mgr."
summary: Codeunit 46858 "BC14 Migration Status Mgr." in HybridBC14 (Microsoft.DataMigration.BC14Reimplementation). 27 public procedures. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - hybridbc14
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 7c554648aa1b463a6918628beeb468828587145e4f4b669603594224c2a36f1d
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/HybridBC14/app/src/Orchestration/BC14MigrationStatusMgr.codeunit.al
    title: src/Apps/W1/HybridBC14/app/src/Orchestration/BC14MigrationStatusMgr.codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9200
object_type: codeunit
object_id: 46858
name: BC14 Migration Status Mgr.
namespace: Microsoft.DataMigration.BC14Reimplementation
app: HybridBC14
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 34
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 1
  called_by: 7
  implements: 0
---

# Codeunit 46858 "BC14 Migration Status Mgr."

> Codeunit 46858 "BC14 Migration Status Mgr." in HybridBC14 (Microsoft.DataMigration.BC14Reimplementation). 27 public procedures. Introduced in BC29, still in BC30.

HybridBC14 · Microsoft.DataMigration.BC14Reimplementation · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/HybridBC14/app/src/Orchestration/BC14MigrationStatusMgr.codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |

## Procedures

- `MarkCompanyStarted(CompanyName: Text[30]): Boolean`: Transitions a company into Started. Returns false on invalid prior state (missing row, Completed, or Failed); caller should abort the upgrade.
- `MarkCompanyCompleted(CompanyName: Text[30])`
- `MarkCompanyFailed(CompanyName: Text[30]; StatusMessage: Text)`
- `SetFinalCompanyStatus(CompanyName: Text[30]; HasErrors: Boolean)`: Called by FinalizeMigration after Posting + Historical complete. Does not overwrite an existing Failed (set by FailureHandler) — fail wins.
- `UpdateCompanyMessage(CompanyName: Text[30]; MessageText: Text)`: Writes an informational message to the company's Status Message blob without changing the Upgrade Status. Use when the upgrade has not failed but we want to surface a note on the Upgrading Companies page (e.g. "TaskScheduler busy, falling back to StartSession").
- `MarkPendingCompaniesAsFailed(StatusMessage: Text)`
- `ResetFailedCompaniesToPending(): Integer`: Flips every Failed company back to Pending so the operator can retry them after fixing the underlying data. Clears the per-row failure message — the durable error history lives in the BC14 Migration Error table, not on Hybrid Company Status. Returns the number of rows reset.
- `SetSummaryInProgress(var HybridReplicationSummary: Record "Hybrid Replication Summary")`
- `SetSummaryFailed(var HybridReplicationSummary: Record "Hybrid Replication Summary")`
- `EvaluateAndSetFinalSummaryStatus(var HybridReplicationSummary: Record "Hybrid Replication Summary")`
- `AfterCompanyMigrationCompleted(CompanyName: Text[30]; HasErrors: Boolean; HistoricalCompleted: Boolean; var HybridReplicationSummary: Record "Hybrid Replication Summary")`: Unified post-company decision used by both the initial run and rerun paths. Failure + Stop On First Error -> Company Failed, Summary UpgradeFailed, stop. Failure + Continue On Error -> Company Failed, chain to next pending company; Summary failure is decided at TryFinalizeOverallStatus. Success + Hi...
- `TryFinalizeOverallStatus(var HybridReplicationSummary: Record "Hybrid Replication Summary")`: Idempotent: the terminal-state check makes repeat calls (e.g. from the main flow and a late Historical worker) a no-op once the summary has been finalized.
- `AcquireRerunSlot(CompanyName: Text[30])`: Atomic rerun guard. Errors if another rerun is already Started, or if the status row was wiped (e.g. Reset All Cloud Data) — never silently accept a rerun against missing state.
- `IsCompanyRunning(CompanyName: Text[30]): Boolean`
- `IsCompanyFailed(CompanyName: Text[30]): Boolean`
- `HasPendingCompanies(): Boolean`
- `AnyCompanyHasFailedUpgrade(): Boolean`
- `AreAllCompaniesUpgradeCompleted(): Boolean`
- `AreAllCompaniesProcessed(): Boolean`
- `GetCompletedCompanyCount(): Integer`
- `GetCompanyStatusCounts(var PendingCount: Integer; var StartedCount: Integer; var CompletedCount: Integer; var FailedCount: Integer)`: Excludes the empty-name PerDatabase row so counts match the companies shown on the page.
- `FilterPendingCompanies(var HybridCompanyStatus: Record "Hybrid Company Status")`
- `FilterFailedCompanies(var HybridCompanyStatus: Record "Hybrid Company Status")`
- `GetFirstPendingCompanyName(): Text[30]`
- `PerDatabaseStatusExists(): Boolean`
- `DeleteAllCompanyStatus()`
- `DeleteCompanyStatus(CompanyName: Text[30])`

Plus 7 local procedures.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 46862 "BC14 Migration Orchestrator"](../codeunit/46862.md) (1 call: `AfterCompanyMigrationCompleted → DispatchNextReadyCompany`)

## Called by

- [Codeunit 46862 "BC14 Migration Orchestrator"](../codeunit/46862.md) (15 calls: `DispatchNextReadyCompany → FilterPendingCompanies`, `DispatchNextReadyCompany → TryFinalizeOverallStatus`, `DispatchNextReadyCompany → UpdateCompanyMessage`, …)
- [Codeunit 46875 "BC14 Migration Runner"](../codeunit/46875.md) (7 calls: `ContinueCompanyMigration → AfterCompanyMigrationCompleted`, `ContinueMigrationForCompany → AcquireRerunSlot`, `ContinueMigrationForCompany → SetSummaryInProgress`, …)
- [Page extension 46870 "BC14 Cloud Migration Mgmt Ext"](../pageextension/46870.md) (4 calls: `RerunFailedCompanies → FilterFailedCompanies`, `ResumeBC14UpgradeAction → GetCompanyStatusCounts`, `UpdateCompanyUpgradeStatus → GetCompanyStatusCounts`, …)
- [Codeunit 46853 "BC14 Company Upgrade Task"](../codeunit/46853.md) (3 calls: `ExecuteCompanyUpgrade → AfterCompanyMigrationCompleted`, `ExecuteCompanyUpgrade → MarkCompanyCompleted`, `ExecuteCompanyUpgrade → MarkCompanyStarted`)
- [Codeunit 46860 "BC14 Migration Failure Handler"](../codeunit/46860.md) (3 calls: `MarkUpgradeFailed → IsCompanyFailed`, `MarkUpgradeFailed → MarkCompanyFailed`, `OnRun → SetSummaryFailed`)
- [Codeunit 46861 "BC14 Wizard"](../codeunit/46861.md) (2 calls: `CompanyOnAfterDelete → DeleteCompanyStatus`, `OnResetAllCloudData → DeleteAllCompanyStatus`)
- [Codeunit 46864 "BC14 Historical Task Worker"](../codeunit/46864.md) (2 calls: `HandleHistoricalFailure → MarkCompanyFailed`, `OnRun → IsCompanyFailed`)

## Recent changes

- 2026-07-23 [#9200 Cloud Migration bug fixes (BC14 reimplementation, custom mapping, OnPrem dev companies)](../../changes/bcapps/9200.md) (main, BC30, fix)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "BC14 Migration Status Mgr.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
