Guidelines for Partners
Sooner or later, most Business Central users will need to transition their current solutions to the new Price Calculation module to ensure continued functionality and access to the latest features. To help make this process easier, we’ve gathered some valuable information and tips to guide you through the upgrade.
Before using the new Price Calculation module, you must enable the “New sales pricing experience” on the Feature Management page. Note that this action is irreversible.
Tables
The old price calculations in Business Central (Version 15.0) relied on the many different tables to store information about prices, costs, and discounts:
- Table 201: “Resource Price”
- Table 202: “Resource Cost”
- Table 335: “Resource Price Change”
- Table 1013: “Job Item Price”
- Table 1012: “Job Resource Price”
- Table 1014: “Job G/L Account Price”
- Table 7002: “Sales Price”
- Table 7004: “Sales Line Discount”
- Table 7012: “Purchase Price”
- Table 7014: “Purchase Line Discount”
With the new Price Calculation module introduced in Business Central (Version 16.0), the following tables are now used instead:
- Table 7000: “Price List Header”
- Table 7001: “Price List Line”
Additionally:
- Tables 1304 “Sales Price and Line Disc Buff” and 7023 “Sales Price Worksheet” are replaced by table 7022 “Price Worksheet Line”.
The key link between the new Price Calculation tables and the older Price Calculation tables is the use of an source (e.g., Customer, Customer Price Group, Customer Disc. Group, Vendor, Job, Campaign, Contact) and an asset (e.g., Item, Item Discount Group, Resource, Resource Group, Service Cost, G/L Account). These are managed using two enums:
- Enum 7003: “Price Source Type”
- Enum 7004: “Price Asset Type”
Codeunit 7009 “CopyFromToPriceListLine,” provides good examples of how fields are transferred from various tables to the “Price List Line” and “Price List Header” tables. Here are a few examples:
Field | replacement in new implementation (V16) of price calculation |
“Sales Type” | “Source Type” (Enum 7003 “Price Source Type”) |
“Sales Code” | “Assign-to No.” OR “Source No.” (Data entered into one field is automatically inserted into the other.) |
“Item No.” | “Asset No.” where “Asset Type”::Item OR “Product No.” (Data entered into one field is automatically inserted into the other.) |
Type | “Asset Type” (Enum 7004 “Price Asset Type”) |
Code | “Asset No.” |
“Job No.” | “Parent Source No.” where “Source Type”:: Job |
“Job Task No.” | “Assign-to No.” OR “Source No.” where “Source Type”:: “Job Task” |
“Unit Cost Factor” | “Cost Factor” |
“Apply Job Discount” | “Allow Line Disc.” |
“Vendor No.” | “Assign-to No.” OR “Source No.” where “Source Type”::Vendor OR “Source Type”::All Vendors (Data entered into one field is automatically inserted into the other.) |
“G/L Account No.” | “Asset No.” where “Asset Type”::”G/L Account” OR “Product No.” (Data entered into one field is automatically inserted into the other.) |
Important: When inserting new lines to the “Price List Line” table, ensure that the Status field is set to Status::Active for the inserted prices to work.
Pages
Old Price Calculations pages have been mostly replaced with pages 7016 “Sales Price List”, 7001 “Price List Lines”, 7024 “Prices Overview”, 7018 “Purchase Price List”, page 7011 “Purchase Price List Lines”, page 7005 “Price List Line Review”.
Closest page 7002 “Sales Prices” alternative is page 7024 “Prices Overview”.
You can run various Price List pages using codeunit 7018 “Price UX Management”.
Codeunits
Changes to the new Price Calculation codeunits can be moved in the following ways:
- Subscribing to events.
- Extending enums 7011 “Price Calculation Handler” and 7000 “Price Calculation Method”, and creating your own Price Calculation codeunit that implements the “Price Calculation” interface. Alternatively, you can copy and modify the standard codeunit 7002 “Price Calculation – V16”. Once completed, set your new implementation as the default on the “Price Calculation Setup” page.
Codeunit 7000 “Sales Price Calc. Mgt.”: corresponding procedures and procedure refactoring
- Procedure “FindSalesPrice”:
Old version (Version 15.0, NAV 14):
var
SalesPriceCalcMgt: Codeunit “Sales Price Calc. Mgt.”;
SalesPrice: Record “Sales Price”;
SalesPriceCalcMgt.FindSalesPrice(SalesPrice,CustNo,ContNo,CustPriceGrCode,CampaignNo,”No.”,”,”,Currency.Code,DateReq,FALSE);
New (Version 16.0, BC 25):
var
SalesHeader: Record “Sales Header”;
SalesLine: Record “Sales Line”;
PriceCalculationMgt: Codeunit “Price Calculation Mgt.”;
LineWithPrice: Interface “Line With Price”;
PriceCalculation: Interface “Price Calculation”;
TempSalesPrice: Record “Price List Line” temporary;
PriceSourceList: Codeunit “Price Source List”;
Clear(LineWithPrice);
Clear(PriceSourceList);
Clear(PriceCalculation);
SalesLine.Init();
SalesLine.Type := SalesLine.Type::Item;
SalesLine.”No.” := Item.”No.”;
SalesLine.”Variant Code” := VariantCode;
SalesLine.”Posting Date” := DateReq;
SetCurrencyFactorInHeader(SalesHeader);
SalesLine.GetLineWithPrice(LineWithPrice);
LineWithPrice.SetLine(Enum::”Price Type”::Sale, SalesHeader, SalesLine);
PriceSourceList.Init();
PriceSourceList.Add(“Price Source Type”::”Customer Price Group”, CustPriceGrCode);
PriceSourceList.Add(“Price Source Type”::Customer, CustNo);
PriceSourceList.Add(“Price Source Type”::Contact, ContNo);
PriceSourceList.Add(“Price Source Type”::Campaign, CampaignNo);
LineWithPrice.SetSources(PriceSourceList);
PriceCalculationMgt.GetHandler(LineWithPrice, PriceCalculation);
PriceCalculation.FindPrice(TempSalesPrice, false);
- Procedure “FindSalesLineDisc”
Old version (Version 15.0, NAV 14):
var
SalesPriceCalcMgt: Codeunit “Sales Price Calc. Mgt.”;
SalesLineDisc: Record “Sales Line Discount”;
SalesPriceCalcMgt.FindSalesLineDisc(SalesLineDisc,CustNo,ContNo,CustDiscGrCode,CampaignNo,”No.”,”Item Disc. Group”,”,”,Currency.Code,DateReq,FALSE);
New (Version 16.0, BC 25):
var
SalesHeader: Record “Sales Header”;
SalesLine: Record “Sales Line”;
PriceCalculationMgt: Codeunit “Price Calculation Mgt.”;
LineWithPrice: Interface “Line With Price”;
PriceCalculation: Interface “Price Calculation”;
TempSalesPrice: Record “Price List Line” temporary;
PriceSourceList: Codeunit “Price Source List”;
Clear(LineWithPrice);
Clear(PriceSourceList);
Clear(PriceCalculation);
SalesLine.Init();
SalesLine.Type := SalesLine.Type::Item;
SalesLine.”No.” := Item.”No.”;
SalesLine.”Variant Code” := VariantCode;
SalesLine.”Posting Date” := DateReq;
SetCurrencyFactorInHeader(SalesHeader);
SalesLine.GetLineWithPrice(LineWithPrice);
LineWithPrice.SetLine(“Price Type”::Sale, SalesHeader, SalesLine);
PriceSourceList.Init();
PriceSourceList.Add(“Price Source Type”::”Customer Disc. Group”, CustDiscGrCode);
PriceSourceList.Add(“Price Source Type”::Customer, CustNo);
PriceSourceList.Add(“Price Source Type”::Contact, ContNo);
PriceSourceList.Add(“Price Source Type”::Campaign, CampaignNo);
LineWithPrice.SetSources(PriceSourceList);
PriceCalculationMgt.GetHandler(LineWithPrice, PriceCalculation);
PriceCalculation.FindDiscount(TempSalesLineDisc, false);
- Procedure “CalcBestUnitPrice” replaced with procedure “Price Calculation – V16” procedure “CalcBestAmount”.
- Procedure “FindSalesLinePrice” replaced with procedure codeunit 7002 “Price Calculation – V16” procedure “FindLines”.
You can also find many of the codeunit 7000 “Sales Price Calc. Mgt.” procedures moved to codeunit 7008 “Price Calculation Buffer Mgt.”. For example:
Codeunit 7000 “Sales Price Calc. Mgt.” procedures | codeunit 7008 “Price Calculation Buffer Mgt.” procedures |
Local PROCEDURE “IsInMinQty” | Procedure “IsInMinQty” |
LOCAL PROCEDURE “ConvertPriceToVAT” | Procedure “ConvertAmountByTax” |
LOCAL PROCEDURE “SetCurrency” | Local procedure “CalcUnitAmountRoundingPrecision” |
LOCAL PROCEDURE “ConvertPriceLCYToFCY” | Procedure “ConvertAmountByCurrency” and procedure “RoundPrice” |
Conclusion
Upgrading to the new Price Calculation module ensures your solution stays functional and up-to-date. Use these tips to ensure a smooth and easy transition.