microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 104010 - "UPG Set Country App Areas" - OnAfterSetApplicationAreaSetup #15521

Closed chliebich closed 2 years ago

chliebich commented 2 years ago

Please add a new integration event OnAfterSetApplicationAreaSetup in Codeunit 104010 .

local procedure SetCountryAppAreas()
var
    ApplicationAreaSetup: Record "Application Area Setup";
    UpgradeTag: Codeunit "Upgrade Tag";
    UpgradeTagDefinitions: Codeunit "Upgrade Tag Definitions";
begin
    IF UpgradeTag.HasUpgradeTag(UpgradeTagDefinitions.GetCountryApplicationAreasTag) THEN
        EXIT;

    IF ApplicationAreaSetup.GET AND ApplicationAreaSetup.Basic THEN BEGIN
        ApplicationAreaSetup.VAT := TRUE;
        ApplicationAreaSetup."Basic EU" := TRUE;
        ApplicationAreaSetup."Basic DE" := TRUE;
        ApplicationAreaSetup.Modify();
    END;

+   OnAfterSetApplicationAreaSetup();

    UpgradeTag.SetUpgradeTag(UpgradeTagDefinitions.GetCountryApplicationAreasTag);
end;

New integration event:

[IntegrationEvent(false, false)]
local procedure OnAfterSetApplicationAreaSetup()
begin
end;
Stepanenko-Vadim commented 2 years ago

We will not add events into upgrade code units. If you wish to run your code before or instead an upgrade routine you should subscribe to OnCheckPreconditionsPerCompany , insert the tag that is being inserted here (so this upgrade routine is naturally skipped), then do any of your own upgrade routines when you deem necessary, with your own flags etc. We understand that in this case it will lead to some code duplication, sorry for the inconvenience.

JesperSchulz commented 2 years ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Stepanenko-Vadim commented 2 years ago

Same as in 15522, my message is the correct one, sorry for the possible confusion :)