---
id: object/codeunit/312
type: object
title: Codeunit 312 "Cust-Check Cr. Limit"
summary: Codeunit 312 "Cust-Check Cr. Limit" in Base Application (Microsoft.Sales.Customer). 13 public procedures, 12 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC27-28.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "28"
  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: f577a6aaa19c0048ce19673aa1f1cb179838b414b7d639ac43aacda352d0afa7
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Sales/Customer/CustCheckCrLimit.Codeunit.al
    title: src/Layers/W1/BaseApp/Sales/Customer/CustCheckCrLimit.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: 312
name: Cust-Check Cr. Limit
namespace: Microsoft.Sales.Customer
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 27
  events: 12
  subscribers: 1
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 1
  calls: 2
  called_by: 9
  implements: 0
---

# Codeunit 312 "Cust-Check Cr. Limit"

> Codeunit 312 "Cust-Check Cr. Limit" in Base Application (Microsoft.Sales.Customer). 13 public procedures, 12 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC27-28.

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

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "My Notifications" = rimd |

## Events published

- `OnNewCheckRemoveCustomerNotifications(RecId: RecordID; RecallCreditOverdueNotif: Boolean)` (integration): Raises an event to remove existing customer credit and overdue notifications before sending new ones.
  - subscribers: [Codeunit 1508 "Notification Lifecycle Handler"](../codeunit/1508.md) OnCustCheckCrLimitCheckRecallNotifs
- `OnBeforeGenJnlLineCheck(GenJnlLine: Record "Gen. Journal Line"; var IsHandled: Boolean)` (integration): Raised before checking the credit limit for a general journal line.
- `OnBeforeSalesHeaderCheck(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean; var CreditLimitExceeded: Boolean)` (integration): Raised before checking the credit limit for a sales header.
- `OnBeforeCreateAndSendNotification(RecordId: RecordID; AdditionalContextId: Guid; Heading: Text[250]; NotificationToSend: Notification; var IsHandled: Boolean; var CustCheckCreditLimit: Page "Check Credit Limit")` (integration): Raised before creating and sending a credit limit notification.
- `OnBeforeSalesLineCheck(var SalesLine: Record "Sales Line"; var IsHandled: Boolean; var CreditLimitExceeded: Boolean)` (integration): Raised before checking the credit limit for a sales line.
- `OnSalesHeaderCheckOnBeforeShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration): Raised before showing the credit limit warning for a sales header.
- `OnSalesLineCheckOnBeforeShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration): Raised before showing the credit limit warning for a sales line.
- `OnServiceHeaderCheckOnBeforeShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration, obsolete 27.0)
- `OnServiceLineCheckOnBeforeShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration, obsolete 27.0)
- `OnServiceContractHeaderCheckOnBeforeShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration, obsolete 27.0)
- `OnBlanketSalesOrderToOrderCheckOnBeforeSalesHeaderShowWarning(var CustCheckCreditLimit: Page "Check Credit Limit")` (integration): Raised before showing the credit limit warning when converting a blanket order to a sales order.
- `OnBeforeBlanketSalesOrderToOrderCheck(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)` (integration): Raised before checking the credit limit when converting a blanket order to a sales order.

## Event subscriptions

- OnInitializingNotificationWithDefaultState subscribes to Page "My Notifications" OnInitializingNotificationWithDefaultState

## Procedures

- `GenJnlLineCheck(GenJnlLine: Record "Gen. Journal Line")`: Checks customer credit limit for a general journal line and sends notification if exceeded.
- `SalesHeaderCheck(var SalesHeader: Record "Sales Header"): Boolean`: Checks customer credit limit for a sales header and sends notification if exceeded.
- `SalesLineCheck(SalesLine: Record "Sales Line"): Boolean`: Checks customer credit limit for a sales line and sends notification if exceeded.
- `GetInstructionType(DocumentType: Code[30]; DocumentNumber: Code[20]): Code[50]`: Generates an instruction type code for credit limit checking based on document type and number.
- `BlanketSalesOrderToOrderCheck(SalesOrderHeader: Record "Sales Header")`: Checks customer credit limit when converting a blanket sales order to a sales order.
- `ShowNotificationDetails(CreditLimitNotification: Notification)`: Displays the credit limit notification details page with information from the notification.
- `GetCreditLimitNotificationId(): Guid`: Retrieves the unique identifier for the credit limit notification.
- `GetOverdueBalanceNotificationId(): Guid`: Retrieves the unique identifier for the overdue balance notification.
- `GetBothNotificationsId(): Guid`: Retrieves the unique identifier for combined credit limit and overdue balance notifications.
- `IsCreditLimitNotificationEnabled(Customer: Record Customer): Boolean`: Checks if the credit limit notification is enabled for the specified customer.
- `IsOverdueBalanceNotificationEnabled(Customer: Record Customer): Boolean`: Checks if the overdue balance notification is enabled for the specified customer.
- `GetCreditLimitNotificationMsg(): Text`: Retrieves the message text displayed for credit limit notifications.
- `GetOverdueBalanceNotificationMsg(): Text`: Retrieves the message text displayed for overdue balance notifications.

Plus 1 local procedures.

## Triggers

OnRun

## 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 1330 "Instruction Mgt."](../codeunit/1330.md) (2 calls: `SalesHeaderCheck → IsEnabled`, `SalesLineCheck → IsEnabled`)
- [Codeunit 1511 "Notification Lifecycle Mgt."](../codeunit/1511.md) (1 call: `CreateAndSendNotification → SendNotificationWithAdditionalContext`)

## Called by

- [Page 343 "Check Credit Limit"](../page/343.md) (7 calls: `ShowWarning → GetBothNotificationsId`, `ShowWarning → GetCreditLimitNotificationId`, `ShowWarning → GetCreditLimitNotificationMsg`, …)
- [Page 6489 "Serv. Check Credit Limit"](../page/6489.md) (7 calls: `ShowWarning → GetBothNotificationsId`, `ShowWarning → GetCreditLimitNotificationId`, `ShowWarning → GetCreditLimitNotificationMsg`, …)
- [Codeunit 1508 "Notification Lifecycle Handler"](../codeunit/1508.md) (2 calls: `OnCustCheckCrLimitCheckRecallNotifs → GetCreditLimitNotificationId`, `OnCustCheckCrLimitCheckRecallNotifs → GetOverdueBalanceNotificationId`)
- [Codeunit 6620 "Copy Document Mgt."](../codeunit/6620.md) (2 calls: `CheckCreditLimit → SalesHeaderCheck`, `InitAndCheckSalesDocuments → SalesHeaderCheck`)
- [Codeunit 87 "Blanket Sales Order to Order"](../codeunit/87.md) (2 calls: `CreateSalesHeader → SalesHeaderCheck`, `OnRun → BlanketSalesOrderToOrderCheck`)
- [Table 36 "Sales Header"](../table/36.md) (2 calls: `CheckCreditLimit → SalesHeaderCheck`, `CheckCreditMaxBeforeInsert → SalesHeaderCheck`)
- [Page 42 "Sales Order"](../page/42.md) (1 call: `OnAfterGetCurrRecord → SalesHeaderCheck`)
- [Table 37 "Sales Line"](../table/37.md) (1 call: `CheckCreditLimit → SalesLineCheck`)
- [Table 81 "Gen. Journal Line"](../table/81.md) (1 call: `ValidateAmount → GenJnlLineCheck`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25, BC27-28

## Deprecations

- procedure OnServiceContractHeaderCheckOnBeforeShowWarning: Pending 27.0 (#if not CLEAN27), "Moved to codeunit Serv. Check Credit Limit"
- procedure OnServiceHeaderCheckOnBeforeShowWarning: Pending 27.0 (#if not CLEAN27), "Moved to codeunit Serv. Check Credit Limit"
- procedure OnServiceLineCheckOnBeforeShowWarning: Pending 27.0 (#if not CLEAN27), "Moved to codeunit Serv. Check Credit Limit"

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: "Cust-Check Cr. Limit")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
