| Docs Help
  AppSource  
Docs  /  Solution  /  Construction Base  /  Developer Information

 Event Subscribers & Management Codeunits


2026/09/10 • 6 min. to read
This page is intended for partners and implementers who need to understand the technical integration points of Construction Base: which standard Business Central / MEGABAU 365 events are subscribed to, and what the shared helper codeunits do. It does not describe end-user functionality.

CB Event Handler

CB Event Handler (codeunit CBEventHandlerNVX) is the main collection of event subscribers that integrate Construction Base with standard Business Central and MEGABAU 365 processes. The subscribers fall into the following groups.
AreaWhat the subscribers do
Job/order traceability on Production and Item JournalsSubscribers on "Requisition Line", "Production Journal Mgt", "Item Journal Line" (OnAfterValidateEvent on Order No.), "Item Jnl.-Post Line" and "Whse. Jnl.-Register Line" / "WMS Management" / "Job Jnl.-Post Line" propagate Job No., Job Task No., BoQ Sales Order No. and Demand Requisition No. from the Production Order onto Item Journal Lines, Item Ledger Entries and Warehouse Journal Lines, so the origin of a transaction stays traceable end to end.
Demand Requisition processingThe subscriber on page "Demand RequestMGB", event OnBeforeCreateRequisitionLines, replaces the standard line creation: it builds Requisition Worksheet lines from the Demand Requisition Planning Lines (procedure FillWorksheetLines) and, unless planning templates are used, creates and refreshes a Production Order per item with Replenishment System "Prod. Order" (procedure CreateProdOrder).
Job default dimension automationOnAfterInsertEvent / OnAfterModifyEvent on table Job create a default "cost unit" and set Global Dimension 2 = Job No. automatically, when enabled in CB Setup ("Autom. Def. Dim. 2 on Job").
Standard warehouse adjustment handlingSubscribers on "Release Purchase Document", "Req. Wksh.-Make Order", "Purch.-Post", "Whse.-Purch. Release", report "Get Source Documents" and "Whse. Jnl.-Register Line" carry the CBDeliveryTypeNVX value through requisition, purchase and warehouse posting, and suppress the Job No. filter / job costing / negative-adjustment warehouse entry for lines flagged as "Standard warehouse adjustment".
Contact / Industry Group synchronizationOnAfterInsertEvent / OnAfterModifyEvent / OnAfterDeleteEvent on "Contact Industry Group" call CBMgtNVX.ContactIndustryGroupMerge to replicate the change to the companies configured in the Contact Branch Companies list (see Contact Branches). OnAfterReleasePurchaseDoc on "Release Purchase Document" calls CBMgtNVX.UpdateContactBranch to derive and assign an Industry Group to the Buy-from Contact from the items on a released purchase order.
Contact Attribute cleanupOnAfterDeleteEvent on table Contact removes all Contact Attribute assignments (CBContactContactAttributesNVX) for a deleted company contact.
Customer/Vendor blocking cascadeOnAfterModifyEvent on Customer and Vendor detect a change of Blocked to/from "All" and call CBMgtNVX.CustomerBlockedAll / VendorBlockedAll, which opens the linked contacts so they can be blocked or unblocked together with the customer/vendor.
Job-reserved inventory in availability figuresOnAfterCalculateNeed (codeunit "Item Availability Forms Mgt") and OnAfterMakeEntries (page "Item Availability Line List") add the item's job-reserved inventory (field CBInventoryOnJobNVX) into the gross requirement / availability breakdown.
Vendor certificatesOnBeforeActionEvent on page "Vendor Card", action CertificatesMGB, stores the current vendor number in CBSingleInstanceNVX so the certificates page can pick it up.

CB Global Event Handler

CB Global Event Handler (codeunit CBGlobalEventHandlerNVX) subscribes to the "Global Triggers" codeunit (GetDatabaseTableTriggerSetup and OnDatabaseInsert/Modify/Delete/Rename) to drive Construction Base's generic multi-company data mirroring engine: for every table flagged as mirrored (table CBMirroredTablesNVX), database changes are forwarded to CBMgtNVX.StartMirror, which replays the change on the configured target companies (see codeunit CBRunMirrorNVX and the Data Mirroring feature). It also subscribes to OnBeforePostJobExpDoc on codeunit "Post Project ExpensesMGB" to block posting of a Site Pick List that has machinery lines unless its approval status is Approved - the enforcement point for the Automatic Approval workflow.

CB Mgt

CB Mgt (codeunit CBMgtNVX) is the general-purpose helper codeunit used throughout Construction Base. Its procedures group into the following areas.
AreaProcedures / responsibility
Resource team managementCreateTeamMembersOverview, InitViewSorting and CheckTeamMemberOverlap build the team-member overview and detect/resolve overlapping team memberships of a resource.
Job Time Recording releaseReleaseJobTimeRec and CreateTimeSheetLine transfer Job Time Recording entries into Job Expense (Time Sheet / Daily Construction Site) lines, creating or updating the Time Sheet header as needed.
Data Mirroring engineMirrorIsActive, MirrorAlreadyRunning, StartMirror, SetMirrorIsRunning and TablesAreMirrored implement the core mirroring engine invoked from CB Global Event Handler; ContactIndustryGroupMerge and UpdateContactBranch use it specifically for Contact Industry Group data.
Site Pick approval workflowSetSitePickApprovalStatus is the central procedure that changes a Site Pick List's approval status: it validates who is allowed to approve/reject, updates the status, writes the Approval Entry, triggers posting on Approved and sends the notification e-mail. TestSitePickStatusOpen (overloads for header, line and machinery line), TestHasMachinery, GetOpenSitePickApprovals and GetSalesPersonSitePicks support status checks and Role Center cues; SendSitePickEmail / AddRecipient build and send the approval-request/rejection e-mails. See Automatic Approval workflow.
Job and bin inventoryGenerateJobInventoryView, GetJobBinContents and GetBinContentNoOfJobs compute and display the inventory currently held on a job or in a specific bin, broken down by job.
Role Center cuesGetDamageReportList, GetJobList and MarkUserJobByJobTask (overloads for Job and Job Expense Header) count and, on request, open the open damage reports, jobs and Site Pick Lists relevant to the current user.
Site Pick return processingSitePickItemReturnSuggestion, GetSitePickReturnTempItemLedgerEntry and CreateSitePickReturnSuggestionLines propose and create material return lines on a Site Pick List (return shipment) from the job's posted consumption, including item tracking reservations (CreateReturnLineReservationEntry).
Purchasing / requisition helpersIsStandardWarehouseAdjustment, ImportTenderers/InsertTenderer and CBDeliveryTypeToDeliveryType support the standard-warehouse-adjustment purchase flow, importing tenderers from an Industry Group's contacts, and converting between the CB and MEGABAU delivery type enums.
Item costingCalculateItemCostsForItemSet recalculates the costing price for a filtered set of items.
Job task defaultsCreateDefaultJobTask creates a default "Entire Job" job task for a new job, when enabled in the Jobs Setup.
Vendor certificate monitoringGetCertificateWarning finds vendors on open purchase BoQ orders whose certificate is about to expire or has expired within a given date formula.
Contact blockingOpenContactBusRelation and BlockContacts open the contacts linked to a customer/vendor (including related person contacts) and lock/unlock them, used by the Customer/Vendor blocking cascade described above.

CB Single Instance

CB Single Instance (codeunit CBSingleInstanceNVX) is a SingleInstance codeunit used as a session-scoped, in-memory buffer between pages/codeunits that do not otherwise share state:
  • SetCurrCBTempMachineryOnJobNVX / GetCurrCBTempMachineryOnJobNVX / ModifyCurrCBTempMachineryOnJobNVX hold the temporary "Machinery on Job" buffer used by the Machinery in Job feature.
  • SetVendorCertificateVendorNo / GetVendorCertificateVendorNo hold the vendor number passed from the Vendor Card's Certificates action (see CB Event Handler above) to the certificates page.

Related information




Submit feedback for
DE|EN Imprint