mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-07 07:36:54 +01:00
Addresses ADO bug 651092. Upgrade and feature data update code must run in the context of the company being upgraded; ChangeCompany leaves triggers, events and upgrade tags in the calling company and races the target company's own upgrade. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
34 lines
1.1 KiB
AL
34 lines
1.1 KiB
AL
codeunit 50260 "Upgrade Current Company"
|
|
{
|
|
Subtype = Upgrade;
|
|
|
|
// The platform runs this trigger once per company, in that company's own session.
|
|
trigger OnUpgradePerCompany()
|
|
begin
|
|
UpgradeShippingAgentCodes();
|
|
end;
|
|
|
|
local procedure UpgradeShippingAgentCodes()
|
|
var
|
|
SalesOrderExt: Record "Sales Order Ext";
|
|
UpgradeTag: Codeunit "Upgrade Tag";
|
|
begin
|
|
if UpgradeTag.HasUpgradeTag(ShippingAgentUpgradeTag()) then
|
|
exit;
|
|
|
|
// Only the current company's rows; triggers, events, and the tag all apply here.
|
|
SalesOrderExt.SetRange("Shipping Agent Code", '');
|
|
if SalesOrderExt.FindSet(true) then
|
|
repeat
|
|
SalesOrderExt.Validate("Shipping Agent Code", SalesOrderExt."Legacy Carrier Code");
|
|
SalesOrderExt.Modify(true);
|
|
until SalesOrderExt.Next() = 0;
|
|
|
|
UpgradeTag.SetUpgradeTag(ShippingAgentUpgradeTag());
|
|
end;
|
|
|
|
local procedure ShippingAgentUpgradeTag(): Code[250]
|
|
begin
|
|
exit('CONTOSO-1001-ShippingAgentCode-20260101');
|
|
end;
|
|
}
|