---
id: object/codeunit/6218
type: object
title: Codeunit 6218 "Sustainability Calc. Mgt."
summary: Codeunit 6218 "Sustainability Calc. Mgt." in Sustainability (Microsoft.Sustainability.Calculation). 10 public procedures, 2 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - sustainability
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: b9845d8df07b97a89fc534add53e0bc30f1640998ae917b143b8da85cbd988ea
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al
    title: src/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.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/10541
    - change/bcapps/10631
    - change/bcapps/10183
object_type: codeunit
object_id: 6218
name: Sustainability Calc. Mgt.
namespace: Microsoft.Sustainability.Calculation
app: Sustainability
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: 18
  events: 2
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 0
  called_by: 6
  implements: 0
---

# Codeunit 6218 "Sustainability Calc. Mgt."

> Codeunit 6218 "Sustainability Calc. Mgt." in Sustainability (Microsoft.Sustainability.Calculation). 10 public procedures, 2 events. Introduced in BC29, still in BC30.

Sustainability · Microsoft.Sustainability.Calculation · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al) · facts from BC29

## Events published

- `OnAfterFilterGLEntry(SustainAccountCategory: Record "Sustain. Account Category"; FromDate: Date; ToDate: Date; var GLEntry: Record "G/L Entry")` (integration)
- `OnBeforeCalculationEmissions(var IsHandled: Boolean; var SustainabilityJnlLine: Record "Sustainability Jnl. Line")` (integration)

## Procedures

- `CalculationEmissions(var SustainabilityJnlLine: Record "Sustainability Jnl. Line")` (internal)
- `CalculationEmissions(var SustainabilityJnlLine: Record "Sustainability Jnl. Line"; SustainAccountCategory: Record "Sustain. Account Category"; SustainAccountSubcategory: Record "Sustain. Account Subcategory")` (internal)
- `CalculationEmissions(var PurchaseLine: Record "Purchase Line")` (internal)
- `CalculationEmissions(var PurchaseLine: Record "Purchase Line"; SustainAccountCategory: Record "Sustain. Account Category"; SustainAccountSubcategory: Record "Sustain. Account Subcategory")` (internal)
- `GetFormulaInputEditability(SustainabilityJnlLine: Record "Sustainability Jnl. Line"; var FuelElectricityEditable: Boolean; var DistanceEditable: Boolean; var CustomAmountEditable: Boolean; var InstallationMultiplierEditable: Boolean; var TimeFactorEditable: Boolean)` (internal)
- `GetFormulaInputEditability(PurchaseLine: Record "Purchase Line"; var FuelElectricityEditable: Boolean; var DistanceEditable: Boolean; var CustomAmountEditable: Boolean; var InstallationMultiplierEditable: Boolean; var TimeFactorEditable: Boolean)` (internal)
- `GetCollectableGLAmount(SustainAccountCategory: Record "Sustain. Account Category"; FromDate: Date; ToDate: Date): Decimal`: Filter general ledger entries by criteria defined in sustainability category and by date and calculate the total
- `CollectGeneralLedgerAmount(var SustainabilityJnlLine: Record "Sustainability Jnl. Line")` (internal)
- `SetCollectingJournalLine(SustainabilityJnlLine: Record "Sustainability Jnl. Line")` (internal)
- `FilterGLEntry(SustainAccountCategory: Record "Sustain. Account Category"; FromDate: Date; ToDate: Date; var GLEntry: Record "G/L Entry")` (internal)

Plus 6 local procedures.

## Called by

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 6210 "Sustainability Account Mgt."](../codeunit/6210.md) (2 calls: `ReCalculateJournalLinesForCategory → CalculationEmissions`, `ReCalculateJournalLinesForSubcategory → CalculationEmissions`)
- [Codeunit 6216 "Sustainability Jnl.-Check"](../codeunit/6216.md) (1 call: `TestEmissionCalculationAndAmount → CalculationEmissions`)
- [Codeunit 6225 "Sust. Purchase Subscriber"](../codeunit/6225.md) (1 call: `OnValidateQuantityOnBeforeResetAmounts → CalculationEmissions`)
- [Page 6219 "Sustainability Journal"](../page/6219.md) (1 call: `SetFormulaInputEditability → GetFormulaInputEditability`)
- [Page 6224 "Collect Amount from G/L Entry"](../page/6224.md) (1 call: `SetCollectingJournalLine → SetCollectingJournalLine`)
- [Page extension 6211 "Sust. Purch. Order Subform"](../pageextension/6211.md) (1 call: `SetFormulaInputEditability → GetFormulaInputEditability`)

## Recent changes

- 2026-09-16 [#10541 [Master] - Slice 641375: [Sustainability] Collect Amount from G/L Entries: track collected entries to prevent double counting](../../changes/bcapps/10541.md) (main, BC30, feature)
- 2026-08-26 [#10631 Integration/main to releases 29.x 31a860b5](../../changes/bcapps/10631.md) (releases/29.x, BC29, feature)
- 2026-08-21 [#10183 Bug 646432: [master] [Sustainability] Line does not indicate/enforce which Calculation Foundation is in use; all formula input fields are editable](../../changes/bcapps/10183.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: "Sustainability Calc. Mgt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
