Business Central 23 breaking changes

Guidelines for Partners

The process of upgrading your extension from earlier Business Central versions to the latest one often reveals a slew of errors, necessitating careful refactoring. Developers might need to engage in fine-tuning their solutions and addressing various breaking changes.  In this article, we will explore some of the frequently encountered issues that typically arise during this upgrade process and provide solutions to assist you in refining your extensions when transitioning to the Business Central 23 OnPrem version.

Here’s the rundown on some of the more common issues developers might face when upgrading to the Business Central 23 OnPrem version.

Business Central 23 Breaking Changes: Codeunits

 

Codeunit 40 “LogInManagement”

Issue: The event OnBeforeCompanyOpen is not found in the target.

Solution: Use event OnShowTermsAndConditions.

 

Issue: The event OnAfterCompanyOpen is not found in the target.

Solution: The event has been removed. If possible, try refactor using the OnShowTermsAndConditions event at the start of the “CompanyOpen” procedure.

 

Issue: The event OnAfterLogInStart is not found in the target.

Solution: The event has been removed. Use event OnAfterLogin from codeunit 150 “System Initialization”.

 

Example:

// SPLN1.00 - Start
//[EventSubscriber(ObjectType::Codeunit, "LogInManagement", 'OnAfterLogInStart', '', false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::"System Initialization", 'OnAfterLogin', '', false, false)]
// SPLN1.00 - End

 

Codeunit 226 “CustEntry-Apply Posted Entries”

Issue: No overload for method “Apply” takes 3 arguments.

Solution: Put the last 2 parameters into a new variable:

ApplyUnapplyParameters: Record “Apply Unapply Parameters”;

Pass this variable to the procedure as a single parameter.

 

Example:

// SPLN1.00 - Start
//CustEntryApplyPostedEntries.Apply(ApplyingCustLedgerEntry, ApplyingCustLedgerEntry."Document No.", ApplicationDate);
ApplyUnapplyParameters."Document No." := ApplyingCustLedgerEntry."Document No.";
ApplyUnapplyParameters."Posting Date" := ApplicationDate;
CustEntryApplyPostedEntries.Apply(ApplyingCustLedgerEntry, ApplyUnapplyParameters);
// SPLN1.00 - End

 

Issue: No overload for method “PostUnApplyCustomer” takes 3 arguments. Candidates: ‘PostUnApplyCustomer(Record “Detailed Cust. Ledg. Entry”, Record “Apply Unapply Parameters” temporary)’ defined in Codeunit ‘CustEntry-Apply Posted Entries’ by the extension Base Application by Microsoft.

Solution: Put the last 2 parameters into a new variable:

ApplyUnapplyParameters: Record “Apply Unapply Parameters”;

Pass this variable to the procedure as a single parameter.

 

Example:

// SPLN1.00 - Start
//CustEntryApplyPostedEntries.PostUnApplyCustomer(DtldCustLedgEntry, DocNo, PostingDate);
ApplyUnapplyParameters."Document No." := DocNo;
ApplyUnapplyParameters."Posting Date" := PostingDate;
CustEntryApplyPostedEntries.PostUnApplyCustomer(DtldCustLedgEntry, ApplyUnapplyParameters);
// SPLN1.00 - End

 

Codeunit 408 “DimensionManagement”

Issue: Codeunit ‘Microsoft.Finance.Dimension.DimensionManagement’ does not contain a definition for “TypeToTableID3”.

Solution: Use procedure “SalesLineTypeToTableID” from codeunit 408

“DimensionManagement” instead.

 

Example:

// SPLN1.00 - Start
//TableID[1] := DimMgt.TypeToTableID3(Type);
TableID[1] := DimMgt.SalesLineTypeToTableID(Type);
// SPLN1.00 - End

 

Issue: No overload for method ”GetDefaultDimID” takes 7 arguments. Candidates: ‘GetDefaultDimID(List of [Dictionary of [Integer, Code[20]]], Code[20], var Code[20], var Code[20], Integer, Integer)’ defined in Codeunit ‘DimensionManagement’ by the extension Base Application by Microsoft.

Solution: As demonstrated in the example below, insert sources into a new variable DefaultDimSource, and call the same procedure.

 

Example:

procedure CreateDim(Type1: Integer; No1: Code[20]; Type2: Integer; No2: Code[20])
var
TableID: array[10] of Integer;
No: array[10] of Code[20];
ItemJnlLine: Record "Item Journal Line";
DefaultDimSource: List of [Dictionary of [Integer, Code[20]]];
begin
DimMgt.AddDimSource(DefaultDimSource, Type1, No1);
DimMgt.AddDimSource(DefaultDimSource, Type2, No2);


//"Shortcut Dimension 1 Code" := '';
//"Shortcut Dimension 2 Code" := '';


// SPLN1.00 - Start
//No[1] := "New Location Code";
DimMgt.AddDimSource(DefaultDimSource, Database::Location, ItemJnlLine."New Location Code");
// SPLN1.00 - End


// SPLN1.00 - Start
// "Dimension ID" :=  DimMgt.GetDefaultDimID(TableID,No,"Source Code","Shortcut Dimension 1 Code","Shortcut Dimension 2 Code","Dimension Set ID",DATABASE::"RetLoyalty Journal Template");
"Dimension Set ID" :=
DimMgt.GetDefaultDimID(
DefaultDimSource, "Source Code", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code", 0, 0);
// SPLN1.00 - End
end;

 

Codeunit 442 “Sales-Post Prepayments”

Issue: The event OnBeforePostBalancingEntry is not found in the target.

Solution: Use event OnPostBalancingEntryOnBeforeGenJnlPostLineRunWithCheck.

 

Codeunit 5807 “Item Charge Assgnt. (Sales)”

Issue: Codeunit Microsoft.Sales.Document.”Item Charge Assgnt. (Sales)”‘ does not contain a definition for ‘SuggestAssignment2’.

Solution: Use the procedure “AssignItemCharges” instead.

 

Codeunit 7312 “Create Pick”

Issue: Codeunit Microsoft.Warehouse.Activity.”Create Pick”‘ does not contain a definition for ‘SetValues’.

Solution: Use the procedure “SetParameters” instead. It has only 1 parameter:

CreatePickParameters: Record “Create Pick Parameters”;

Create this variable, add all values to it, and then pass it to the procedure “SetParameters.”

 

Example:

trigger OnPreDataItem();
var
CreatePickParameters: Record "Create Pick Parameters";
begin
// SPLN1.00 - Start
//CreatePick.SetValues(
// AssignedID, 1, Enum::"Whse. Activity Sorting Method".FromInteger(SortActivity), 1, 0, 0, false, DoNotFillQtytoHandle, BreakbulkFilter, false);
CreatePickParameters."Assigned ID" := AssignedID;
CreatePickParameters."Whse. Document" := CreatePickParameters."Whse. Document"::Shipment;  //1
CreatePickParameters."Sorting Method" := Enum::"Whse. Activity Sorting Method".FromInteger(SortActivity);
CreatePickParameters."Whse. Document Type" := CreatePickParameters."Whse. Document Type"::Pick; //1
CreatePickParameters."Max No. of Source Doc." := 0;
CreatePickParameters."Max No. of Lines" := 0;
CreatePickParameters."Per Zone" := false;
CreatePickParameters."Do Not Fill Qty. to Handle" := DoNotFillQtytoHandle;
CreatePickParameters."Breakbulk Filter" := BreakbulkFilter;
CreatePickParameters."Per Bin" := false;
CreatePick.SetParameters(CreatePickParameters);
// SPLN1.00 - End
end;

Codeunit 99000855 “Planning-Get Parameters”

Issue: Codeunit Microsoft.Inventory.Planning.”Planning-Get Parameters”‘ does not contain a definition for ‘SetUpPlanningControls’.

Solution: Use the procedure “SetPlanningParameters” instead. This procedure takes only 1 parameter:

PlanningGetParam: Codeunit “Planning-Get Parameters”;

All values will be set in this variable.

 

Example:

local procedure EnablePlanningControls()
var
PlanningGetParam: Codeunit "Planning-Get Parameters";
TimeBucketEnabled: Boolean;
SafetyLeadTimeEnabled: Boolean;
SafetyStockQtyEnabled: Boolean;
ReorderPointEnabled: Boolean;
ReorderQtyEnabled: Boolean;
MaximumInventoryEnabled: Boolean;
MinimumOrderQtyEnabled: Boolean;
MaximumOrderQtyEnabled: Boolean;
OrderMultipleEnabled: Boolean;
IncludeInventoryEnabled: Boolean;
ReschedulingPeriodEnabled: Boolean;
LotAccumulationPeriodEnabled: Boolean;
DampenerPeriodEnabled: Boolean;
DampenerQtyEnabled: Boolean;
OverflowLevelEnabled: Boolean;
ReorderCycleEnabled: Boolean;
ReorderQuantityEnabled: Boolean;
PlanningParameters: Record "Planning Parameters";
begin
// SPLN1.00 - Start
//PlanningGetParam.SetUpPlanningControls("Reordering Policy", "Include Inventory",
//  TimeBucketEnabled, SafetyLeadTimeEnabled, SafetyStockQtyEnabled,
//  ReorderPointEnabled, ReorderQtyEnabled, MaximumInventoryEnabled,
//  MinimumOrderQtyEnabled, MaximumOrderQtyEnabled, OrderMultipleEnabled, IncludeInventoryEnabled,
//  ReschedulingPeriodEnabled, LotAccumulationPeriodEnabled,
//  DampenerPeriodEnabled, DampenerQtyEnabled, OverflowLevelEnabled);
PlanningGetParam.SetPlanningParameters(PlanningParameters);
// SPLN1.00 - End


// SPLN1.00 - Start
/*
TimeBucketEnable := TimeBucketEnabled;
SafetyLeadTimeEnable := SafetyLeadTimeEnabled;
SafetyStockQtyEnable := SafetyStockQtyEnabled;
ReorderPointEnable := ReorderPointEnabled;
ReorderQtyEnable := ReorderQtyEnabled;
MaximumInventoryEnable := MaximumInventoryEnabled;
MinimumOrderQtyEnable := MinimumOrderQtyEnabled;
MaximumOrderQtyEnable := MaximumOrderQtyEnabled;
OrderMultipleEnable := OrderMultipleEnabled;
IncludeInventoryEnable := IncludeInventoryEnabled;
ReschedulingPeriodEnable := ReschedulingPeriodEnabled;
LotAccumulationPeriodEnable := LotAccumulationPeriodEnabled;
DampenerPeriodEnable := DampenerPeriodEnabled;
DampenerQtyEnable := DampenerQtyEnabled;
OverflowLevelEnable := OverflowLevelEnabled;
*/
TimeBucketEnable := PlanningParameters."Time Bucket Enabled";
SafetyLeadTimeEnable := PlanningParameters."Safety Lead Time Enabled";
SafetyStockQtyEnable := PlanningParameters."Safety Stock Qty Enabled";
ReorderPointEnable := PlanningParameters."Reorder Point Enabled";
ReorderQtyEnable := PlanningParameters."Reorder Quantity Enabled";
MaximumInventoryEnable := PlanningParameters."Maximum Inventory Enabled";
MinimumOrderQtyEnable := PlanningParameters."Minimum Order Qty Enabled";
MaximumOrderQtyEnable := PlanningParameters."Maximum Order Qty Enabled";
OrderMultipleEnable := PlanningParameters."Order Multiple Enabled";
IncludeInventoryEnable := PlanningParameters."Include Inventory Enabled";
ReschedulingPeriodEnable := PlanningParameters."Rescheduling Period Enabled";
LotAccumulationPeriodEnable := PlanningParameters."Lot Accum. Period Enabled";
DampenerPeriodEnable := PlanningParameters."Dampener Period Enabled";
DampenerQtyEnable := PlanningParameters."Dampener Quantity Enabled";
OverflowLevelEnable := PlanningParameters."Overflow Level Enabled";
// SPLN1.00 - End
end;

Business Central 23 Breaking Changes: Tables

 

Various standard tables

Issue: No overload for method “CreateDim” takes 10 arguments. Candidates: ‘CreateDim(List of [Dictionary of [Integer, Code[20]]])’ defined in Table ‘Gen. Journal Line’ by the extension Base Application by Microsoft.

Solution: Refactor using the procedure “CreateDim,” which takes one parameter:

DefaultDimSource: List of [Dictionary of [Integer, Code[20]]];

 

Example:

with PurchCrMemoHeader do begin
/*
//SPLN1.00 - Begin
CreateDim(
DATABASE::"Salesperson/Purchaser", "Purchaser Code",
DATABASE::Vendor, "Pay-to Vendor No.",
DATABASE::Campaign, "Campaign No.",
DATABASE::"Responsibility Center", "Responsibility Center");
*/
Clear(DefaultDimSource);
DimMgt.AddDimSource(DefaultDimSource, Database::"Salesperson/Purchaser", "Purchaser Code");
DimMgt.AddDimSource(DefaultDimSource, Database::Vendor, "Pay-to Vendor No.");
DimMgt.AddDimSource(DefaultDimSource, Database::Campaign, "Campaign No.");
DimMgt.AddDimSource(DefaultDimSource, Database::"Responsibility Center", "Responsibility Center");
CreateDim(DefaultDimSource);
//SPLN1.00 - End
end;

Table 38 “Purchase Header”

Issue: The field “Id” has been removed. Reason: This functionality will be replaced by the “systemID” field.

Solution: Use the “systemID” field instead.

 

Table 79 “Company Information”

Issue: The fields “IC Partner Code”, “IC Inbox Type” and “IC Inbox Details” have been removed. Reason: Replaced by the same fields from the “IC Setup” table.

Solution: Fields have been moved to table 443 “IC Setup”.

 

Table 472 “Job Queue Entry”

Issue: The field “Processed by User ID” has been removed. Reason: The “Processed by User ID” is the same as “User ID”.

Solution: Use the “User ID” field instead.

 

Business Central 23 Breaking Changes: Pages

 

Page 579 “Post Application”

Issue: Page “Post Application”‘ does not contain definitions for “SetValues” and “GetValues”.

Solution: Use procedures “SetParameters” and “GetParameters” instead. They have only 1 parameter:

NewApplyUnapplyParameters: Record “Apply Unapply Parameters”;

Place all the parameters into this variable and then pass it to the corresponding procedures.

 

Conclusion

All things considered, transitioning to Business Central 23 OnPrem might present a few challenges, given the array of tweaks and changes awaiting you across different parts of your solutions, that will involve careful maneuvering through various tables, removing redundant variables, and fine-tuning event handling and procedure calls. Navigating these adjustments seamlessly with the recommended fixes is crucial for a smooth upgrade to the latest Business Central version.