Guidelines for Partners
Upgrading software to newer versions often involves a series of changes and adjustments to ensure seamless compatibility and improved functionality. In the context of Business Central, upgrading from previous versions to BC21, BC22 may require developers to address breaking changes and refactor their extensions. This article will explore some of the most common issues encountered during this upgrade process and provide solutions to rework the extensions when upgrading to Business Central 21, Business Central 22 OnPrem version.
Below are some of the frequently encountered issues that developers may face while upgrading to Business Central 21, Business Central 22 OnPrem Version.
Table 36 “Sales Header”
Issue: The event “OnAfterCopyFromSellToCustTemplate” is not found in the target.
Solution: Use “OnAfterCopyFromNewSellToCustTemplate” instead.
Examples:
//SPLN1.00 – Start
//[EventSubscriber(ObjectType::Table, Database::”Sales Header”, ‘OnAfterCopyFromSellToCustTemplate’, ”, false, false)]
[EventSubscriber(ObjectType::Table, Database::”Sales Header”, ‘OnAfterCopyFromNewSellToCustTemplate’, ”, false, false)]
//SPLN1.00 – End
Table 246 “Requisition Line”
Issue: The record “Requisition Line” does not contain a definition for “SetDropShipment”.
Solution: Instead, assign the value to Field 73, “Drop Shipment”.
Examples:
Table 270 “Bank Account”
Issue: The record “Bank Account” does not contain a definition for “Credit limit.”.
Solution: Use the procedure GetCreditLimit instead.
Notes Examples:
Table 1301 “Item Template”
Issue: Table ‘Item Template’ is removed. Reason: Deprecate mini templates. Use table “Item Templ.” instead and for extensions.
Solution: Use table 1382, “Item Templ.”.
Notes Examples:
Issue: Record “Item Templ.” does not contain a definition for InitializeTempRecordFromConfigTemplate.
Solution: The procedure is completely reworked. Check Table 37 “Sales Line” usage rework in procedures ShowNonstock and CheckNonstockItemTemplate.
Notes Examples:
Table 1303 “Mini Vendor Template”
Issue: Table removed.
Solution: Use table “Vendor Templ.” instead.
Notes Examples:
Table 5050 “Contact”
Issue: The event OnBeforeCustomerInsert is not found in the target.
Solution: Use OnCreateCustomerFromTemplateOnBeforeCustomerInsert instead.
Notes Examples:
//SPLN1.00 – Start
//[EventSubscriber(ObjectType::Table, Database::Contact, ‘OnBeforeCustomerInsert’, ”, false, false)]
[EventSubscriber(ObjectType::Table, Database::Contact, ‘OnCreateCustomerFromTemplateOnBeforeCustomerInsert’, ”, false, false)]
//SPLN1.00 – End
Issue: The event OnCreateCustomerOnTransferFieldsFromTemplate is not found in the target.
Solution: Use OnApplyTemplateOnBeforeCustomerModify instead. Reworks from Table “Customer Template” to Table “Customer Templ.” will be required because a parameter has changed. Also, the new event is in Codeunit 1381.
Notes Examples:
//SPLN1.00 – Start
//[EventSubscriber((ObjectType::Codeunit, Codeunit::”Customer Templ. Mgt.”, ‘OnCreateCustomerOnTransferFieldsFromTemplate’, ”, false, false)]
[EventSubscriber(ObjectType::Codeunit, Codeunit::”Customer Templ. Mgt.”, ‘OnApplyTemplateOnBeforeCustomerModify’, ”, false, false)]
//SPLN1.00 – End
Issue: The procedure FindCustomerTemplate does not exist in the current context.
Solution: Use FindNewCustomerTemplate.
Notes Examples:
Issue: The procedure ChooseCustomerTemplate does not exist in the current context.
Solution: Use ChooseNewCustomerTemplate.
Notes Examples:
Issue: No overload for method. CreateCustomer takes one argument. Candidates: CreateCustomer().
Solution: Use CreateCustomerFromTemplate.
Notes Examples:
//SPLN1.00 – Start
//Contact.CreateCustomer(LocationPostingGroup.”Customer Template”);
Contact.CreateCustomerFromTemplate(LocationPostingGroup.”Customer Template”);
//SPLN1.00 – End
Table 5717 “Item Cross Reference”
Issue: Table replaced by “Item Reference”.
Solution: Use table “Item Reference” instead.
Notes Examples:
Table 5718 “Nonstock Item”
Issue: The field “Item Template Code” is removed. Reason: This field will be removed with other functionality related to “old” templates. Use the “Item Templ. Code” field instead.
Solution: Use the “Item Templ. Code” field instead.
Notes Examples:
Table 5777 “Item Reference”
Issue: Field “Discontinue Bar Code” removed.
Solution: Remove references or replicate the field in the custom range if needed.
Notes Examples:
When upgrading to BC21/BC22, remove all references or replicate the field in a custom range if necessary. Additionally, if data migration is required, remember to transfer data from standard fields to the new custom fields.
Table 6308 “Power BI Ongoing Deployments”
Issue: Table removed
Solution: Functionality has been moved to Table 6325, “Power BI User Status”
Notes Examples:
Table 11000002 “Payment History Line”
Issue: The procedure NoSourceName does not exist in the current context.
Solution: Use GetSourceName instead.
Notes Examples:
Page 47 “Sales Invoice Subform”
Issue: The action “Get &Price” is not found in the target ‘Sales Invoice Subform’
Solution: Use the action “GetPrice” instead.
Issue: The action “Get Li&ne Discount” is not found in the target ‘Sales Invoice Subform’
Solution: Use the action “GetLineDiscount” instead.
Page 658 “Approval Entries”
Issue: Page “Approval Entries”‘ does not contain a definition for Setfilters.
Solution: Use SetRecordFilters instead.
Notes Examples:
//SPLN1.00 – Start
//ApprovalEntries.Setfilters(DATABASE::”Sales Header”, Enum::”Approval Document Type”.FromInteger(SalesHeader.”Document Type”.AsInteger()), SalesHeader.”No.”);
ApprovalEntries.SetRecordFilters(DATABASE::”Sales Header”, Enum::”Approval Document Type”.FromInteger(SalesHeader.”Document Type”.AsInteger()), SalesHeader.”No.”);
//SPLN1.00 – End
Page 11309 “Apply General Ledger Entries”
Issue: Page ‘Apply General Ledger Entries’ needs to be included.
Solution: Use the Page “General Ledger Entries Apply” instead.
Notes Examples:
Report 5177 “ Delete Purchase Quote Versions”
Issue: Removed.
Solution: Please use the retention policy module to clean up document archive records instead. This should be done in the web client.
Report 5178 “Delete Purchase Order Versions”
Issue: Removed.
Solution: Please use the retention policy module to clean up document archive records instead. This should be done in the web client.
Report 5179 “Delete Sales Quote Versions”
Issue: Removed.
Solution: Please use the retention policy module to clean up document archive records instead. This should be done in the web client.
Report 5180 “Delete Sales Order Versions”
Issue: Removed.
Solution: Please use the retention policy module to clean up document archive records instead. This should be done in the web client.
Codeunit 359 “PeriodFormManagement”
Issue: Codeunit PeriodFormManagement is missing.
Solution: Use Codeunit PeriodPageManagement instead.
Notes Examples:
Codeunit 6500 “Item Tracking Management”
Issue: No overload for method. CheckWhseItemTrkgSetup takes 4 arguments. Candidates: CheckWhseItemTrkgSetup(Code[20]) defined in Codeunit “Item Tracking Management.”
Solution: Use procedure GetWhseItemTrkgSetup with only one parameter ItemNo. If you need previous parameters SNRequired and LNRequired to return value, use procedure GetWhseItemTrkgSetup(ItemNo: Code[20]; var WhseItemTrackingSetup: Record “Item Tracking Setup”), which will return those values added in WhseItemTrackingSetup parameter as fields.
Notes Examples:
// SPLN1.00 – Start
//ItemTrackingMgt.CheckWhseItemTrkgSetup(“Item No.”, WhseSNRequired, WhseLNRequired, false);
//ItemTrackingSplit := WhseSNRequired or WhseLNRequired;
ItemTrackingMgt.GetWhseItemTrkgSetup(“Item No.”, WhseItemTrackingSetup);
ItemTrackingSplit := WhseItemTrackingSetup.”Serial No. Required” or WhseItemTrackingSetup.”Lot No. Required”;
// SPLN1.00 – End
Issue: No overload for method. GetWhseExpirationDate takes six arguments. Candidates: GetWhseExpirationDate(Code[20], Code[20], Record Location, Record “Item Tracking Setup” temporary, var Date) defined in Codeunit Item Tracking Management
Solution: Use the same procedure GetWhseExpirationDate, but instead of passing parameters LotNo: Code[50]; SerialNo: Code[50], use ItemTrackingSetup: Record “Item Tracking Setup” and add values in this table fields.
Notes Examples:
// SPLN1.00 – Start
//ItemTrackingMgt.GetWhseExpirationDate(“Item No.”, “VaCode”, Location, “Lot No.”, “Serial No.”, “Expiration Date”);
ItemTrackingSetup.”Lot No.” := “Lot No.”;
ItemTrackingSetup.”Serial No.” := “Serial No.”;
ItemTrackingMgt.GetWhseExpirationDate(“Item No.”, “Variant CLocation, ItemTrackingSetup, “Expiration Date”);
// SPLN1.00 – End
Issue: Codeunit “Item Tracking Management” does not contain a definition for InitItemTrkgForTempWkshLine.
Solution: Use procedure InitItemTrackingForTempWhseWorksheetLine instead.
Notes Examples:
Codeunit 6520 “Item Tracing Mgt.”
Issue: There is no argument given that corresponds to the required formal parameter ShowComponents of FindRecords(var Record “Item Tracing Buffer”, var Record “Item Tracing Buffer”, Text, Text, Text, Text, Text, Option, Option)
Solution: The new parameter PackageNoFilter was added, which should be filled in on a standard page. To work the same as before, you can just pass an empty value ” to a parameter PackageNoFilter.
Codeunit 7302 “WMS Management”
Issue: Codeunit “WMS Management” does not contain a definition for ShowWhseDocLine.
Solution: Use procedures: ShowWhseActivityDocLine, ShowWhseRcptLine, ShowPostedWhseShptLine according to the case.
Conclusion
In conclusion, upgrading to the Business Central 21, Business Central 22 OnPrem version may involve various challenges and changes across different aspects of extensions. These issues could include table modifications, deprecated features, field removals, event handling, and procedure call adjustments. Addressing these breaking changes with the recommended solutions is essential for a smooth transition to the latest version of Business Central. Rigorous testing and verification will ensure that the upgraded extensions meet the business’s and its users’ specific requirements.
As you embark on the upgrade journey, staying informed about the latest updates and following best practices will contribute to a successful upgrade process. Embracing the advancements in BC21, BC22 will enable your extension to deliver enhanced experiences and value to users.