As usual, we define all of our business logic in an external codeunit called VendorQualityMgt using the tcodeunit snippet, defined as follows:
codeunit 50102 VendorQualityMgt_PKT{ procedure CalculateVendorRate(var VendorQuality: Record "Vendor Quality_PKT") var Handled: Boolean; begin OnBeforeCalculateVendorRate(VendorQuality, Handled); //This is the company's criteria to assign the Vendor rate. VendorRateCalculation(VendorQuality, Handled); OnAfterCalculateVendorRate(VendorQuality); end; local procedure VendorRateCalculation(var VendorQuality: Record "Vendor Quality_PKT"; var Handled: Boolean) begin if Handled then exit; VendorQuality.Rate := (VendorQuality.ScoreDelivery + VendorQuality.ScoreItemQuality + VendorQuality ...