---
id: object/codeunit/102
type: object
title: Codeunit 102 "Import Consolidation from API"
summary: Codeunit 102 "Import Consolidation from API" in Base Application (Microsoft.Finance.Consolidation). 9 public procedures, 7 events. Present since at least BC23, still in BC30, changed in BC24-25.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "25"
  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: f71b52d9282662350141ecddaecefffbd21cbc1ea9939ff80ca737515dce3330
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/Consolidation/ImportConsolidationFromAPI.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/Consolidation/ImportConsolidationFromAPI.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 102
name: Import Consolidation from API
namespace: Microsoft.Finance.Consolidation
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "25"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 58
  events: 7
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 7
  called_by: 5
  implements: 1
---

# Codeunit 102 "Import Consolidation from API"

> Codeunit 102 "Import Consolidation from API" in Base Application (Microsoft.Finance.Consolidation). 9 public procedures, 7 events. Present since at least BC23, still in BC30, changed in BC24-25.

Base Application · Microsoft.Finance.Consolidation · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/Consolidation/ImportConsolidationFromAPI.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | tabledata "General Ledger Setup" = R, tabledata "Gen. Journal Batch" = R |

## Events published

- `OnBeforeGetGLSetup(var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving General Ledger Setup from external Business Central API. Enables custom G/L setup retrieval or bypassing of standard API calls.
- `OnBeforeGetCurrencyExchangeRates(CurrencyFilter: Text; EndingDate: Date; var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving currency exchange rates from external Business Central API. Enables custom exchange rate retrieval or modification of API request parameters.
- `OnBeforeGetGLEntries(DateFilter: Text; AccountNoFilter: Text; var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving G/L entries from external Business Central API. Enables custom G/L entry retrieval or modification of API request filters.
- `OnBeforeGetDimensions(DimensionFilter: Text; var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving dimensions from external Business Central API. Enables custom dimension retrieval or modification of dimension filter parameters.
- `OnBeforeGetGLEntriesCountAtDate(GLAccountNo: Code[20]; ClosingDate: Date; var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving G/L entries count at specific date from external Business Central API. Enables custom entry count retrieval or bypassing of standard API calls for closing date entries.
- `OnBeforeGetAccountingPeriods(StartingDate: Date; EndingDate: Date; var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving accounting periods from external Business Central API. Enables custom accounting period retrieval or modification of date range parameters.
- `OnBeforeGetPostingGLAccounts(var IsHandled: Boolean; var Response: Text)` (integration): Integration event raised before retrieving posting G/L accounts from external Business Central API. Enables custom G/L account retrieval for posting account filtering during consolidation.

## Procedures

- `GetPrivacyConsentChoice(): Boolean` (internal)
- `GetFeatureTelemetryName(): Text` (internal)
- `AcquireTokenAndStoreInIsolatedStorage(BusinessUnit: Record "Business Unit")` (internal)
- `IsStoredTokenValidForBusinessUnit(BusinessUnit: Record "Business Unit"): Boolean` (internal)
- `GetCurrencyFactorFromBusinessUnit(var BusinessUnit: Record "Business Unit"): Decimal` (internal)
- `SelectCompanyForBusinessUnit(var BusinessUnit: Record "Business Unit")` (internal)
- `GetAADTenantIdFromBCUrl(Url: Text): Text` (internal)
- `ValidateBCUrl(Url: Text): Boolean` (internal)
- `ImportConsolidationDataForBusinessUnit(ConsolidationProcess: Record "Consolidation Process"; BusinessUnit: Record "Business Unit"; var BusUnitConsolidationData: Record "Bus. Unit Consolidation Data")`: Imports consolidation data for a specific business unit from external Business Central API. Handles API connection setup, data retrieval, and consolidation processing initialization.

Plus 42 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 432 "Consolidate"](../codeunit/432.md) (10 calls: `GetAndSetCurrencyExchangeRates → InsertExchRate`, `GetAndSetGLEntries → InsertEntryDim`, `GetAndSetGLEntries → InsertGLEntry`, …)
- [Codeunit 501 "OAuth2"](../codeunit/501.md) (4 calls: `GetToken → AcquireAuthorizationCodeTokenFromCache`, `GetToken → AcquireAuthorizationCodeTokenFromCacheWithCertificate`, `GetToken → AcquireTokensByAuthorizationCode`, …)
- [Codeunit 2200 "Azure Key Vault"](../codeunit/2200.md) (2 calls: `GetToken → GetAzureKeyVaultCertificate`, `GetToken → GetAzureKeyVaultSecret`)
- [Codeunit 10 "Type Helper"](../codeunit/10.md) (1 call: `GetAndSetPostingGLAccounts → GetOptionNo`)
- [Codeunit 3960 "Regex"](../codeunit/3960.md) (1 call: `GetAADTenantIdFromBCUrl → Match`)
- [Codeunit 457 "Environment Information"](../codeunit/457.md) (1 call: `GetToken → IsSaaS`)
- [Codeunit 8703 "Feature Telemetry"](../codeunit/8703.md) (1 call: `SelectCompanyForBusinessUnit → LogUptake`)

## Called by

- [Page 242 "Consolidate Wizard"](../page/242.md) (3 calls: `GetBusinessUnitAccessGranted → IsStoredTokenValidForBusinessUnit`, `GetDefaultConsolidateState → IsStoredTokenValidForBusinessUnit`, `OnOpenPage → GetFeatureTelemetryName`)
- [Codeunit 107 "Import and Consolidate"](../codeunit/107.md) (1 call: `ImportAndConsolidate → GetFeatureTelemetryName`)
- [Codeunit 110 "Consolidate Business Units"](../codeunit/110.md) (1 call: `ValidateBusinessUnitsToConsolidate → IsStoredTokenValidForBusinessUnit`)
- [Page 241 "Business Unit Card"](../page/241.md) (1 call: `OnOpenPage → GetFeatureTelemetryName`)
- [Table 220 "Business Unit"](../table/220.md) (1 call: `GetCurrencyFactorFromBusinessUnit → GetCurrencyFactorFromBusinessUnit`)

## Implements

- [Enum 103 "Import Consolidation Data"](../enum/103.md)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-25

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: "Import Consolidation from API")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
