Why do you need this change?
We need to run ExtraChargeMgmt.CopyPostingSetup immediately after Modify() is called inside the user confirmation block in the General Posting Setup dataitem OnAfterGetRecord trigger of Report "Copy Gen. Posting Setup". The standard code only calls Modify() when the user confirms, but our custom logic requires ExtraChargeMgmt.CopyPostingSetup to run in the same confirmation scope — it should only execute when the user clicks Yes, never outside of it.
OnAfterCopyGenPostingSetup fires before the confirmation check and before Modify() — so a subscriber there cannot conditionally run logic based on user confirmation. The report extension OnAfterGetRecord trigger runs after the entire base trigger completes, meaning it runs outside the confirmation block and would execute regardless of what the user chose. No event currently exists inside the confirmation block after Modify() in Report "Copy Gen. Posting Setup".
Describe the request
Add an integration event OnAfterConfirmAndModify in the General Posting Setup dataitem OnAfterGetRecord trigger of Report "Copy Gen. Posting Setup" immediately after Modify() inside the confirmation block.
trigger OnAfterGetRecord()
var
ConfirmManagement: Codeunit "Confirm Management";
begin
GenPostingSetup.Find();
if CopySales then begin
"Sales Account" := GenPostingSetup."Sales Account";
"Sales Credit Memo Account" := GenPostingSetup."Sales Credit Memo Account";
"Sales Line Disc. Account" := GenPostingSetup."Sales Line Disc. Account";
"Sales Inv. Disc. Account" := GenPostingSetup."Sales Inv. Disc. Account";
"Sales Pmt. Disc. Debit Acc." := GenPostingSetup."Sales Pmt. Disc. Debit Acc.";
"Sales Pmt. Disc. Credit Acc." := GenPostingSetup."Sales Pmt. Disc. Credit Acc.";
"Sales Pmt. Tol. Debit Acc." := GenPostingSetup."Sales Pmt. Tol. Debit Acc.";
"Sales Pmt. Tol. Credit Acc." := GenPostingSetup."Sales Pmt. Tol. Credit Acc.";
"Sales Prepayments Account" := GenPostingSetup."Sales Prepayments Account";
end;
if CopyPurchases then begin
"Purch. Account" := GenPostingSetup."Purch. Account";
"Purch. Credit Memo Account" := GenPostingSetup."Purch. Credit Memo Account";
"Purch. Line Disc. Account" := GenPostingSetup."Purch. Line Disc. Account";
"Purch. Inv. Disc. Account" := GenPostingSetup."Purch. Inv. Disc. Account";
"Purch. Pmt. Disc. Debit Acc." := GenPostingSetup."Purch. Pmt. Disc. Debit Acc.";
"Purch. Pmt. Disc. Credit Acc." := GenPostingSetup."Purch. Pmt. Disc. Credit Acc.";
"Purch. FA Disc. Account" := GenPostingSetup."Purch. FA Disc. Account";
"Purch. Pmt. Tol. Debit Acc." := GenPostingSetup."Purch. Pmt. Tol. Debit Acc.";
"Purch. Pmt. Tol. Credit Acc." := GenPostingSetup."Purch. Pmt. Tol. Credit Acc.";
"Purch. Prepayments Account" := GenPostingSetup."Purch. Prepayments Account";
end;
if CopyInventory then begin
"COGS Account" := GenPostingSetup."COGS Account";
"COGS Account (Interim)" := GenPostingSetup."COGS Account (Interim)";
"Inventory Adjmt. Account" := GenPostingSetup."Inventory Adjmt. Account";
"Invt. Accrual Acc. (Interim)" := GenPostingSetup."Invt. Accrual Acc. (Interim)";
end;
if CopyManufacturing then begin
"Direct Cost Applied Account" := GenPostingSetup."Direct Cost Applied Account";
"Overhead Applied Account" := GenPostingSetup."Overhead Applied Account";
"Purchase Variance Account" := GenPostingSetup."Purchase Variance Account";
end;
OnAfterCopyGenPostingSetup("General Posting Setup", GenPostingSetup, CopySales, CopyPurchases, CopyInventory, CopyManufacturing);
if ConfirmManagement.GetResponseOrDefault(Text000, true) then
Modify();
OnAfterConfirmAndModify("General Posting Setup", GenPostingSetup);
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnAfterConfirmAndModify(var ToGeneralPostingSetup: Record "General Posting Setup"; FromGeneralPostingSetup: Record "General Posting Setup")
begin
end;
Alternatives evaluated:
OnAfterCopyGenPostingSetup fires before the confirmation check and before Modify(), so a subscriber there cannot replicate logic that must only run when the user confirms. The report extension OnAfterGetRecord trigger runs after the full base trigger completes outside the confirmation block so it cannot conditionally execute based on user confirmation. No event currently exists inside the confirmation block after Modify() in Report "Copy Gen. Posting Setup".
Why do you need this change?
We need to run
ExtraChargeMgmt.CopyPostingSetupimmediately after Modify() is called inside the user confirmation block in theGeneral Posting SetupdataitemOnAfterGetRecordtrigger of Report "Copy Gen. Posting Setup". The standard code only callsModify()when the user confirms, but our custom logic requiresExtraChargeMgmt.CopyPostingSetupto run in the same confirmation scope — it should only execute when the user clicks Yes, never outside of it.OnAfterCopyGenPostingSetupfires before the confirmation check and beforeModify()— so a subscriber there cannot conditionally run logic based on user confirmation. The report extensionOnAfterGetRecordtrigger runs after the entire base trigger completes, meaning it runs outside the confirmation block and would execute regardless of what the user chose. No event currently exists inside the confirmation block afterModify()in Report "Copy Gen. Posting Setup".Describe the request
Add an integration event
OnAfterConfirmAndModifyin theGeneral Posting SetupdataitemOnAfterGetRecordtrigger of Report "Copy Gen. Posting Setup" immediately afterModify()inside the confirmation block.Event Signature:
Alternatives evaluated:
OnAfterCopyGenPostingSetupfires before the confirmation check and beforeModify(), so a subscriber there cannot replicate logic that must only run when the user confirms. The report extensionOnAfterGetRecordtrigger runs after the full base trigger completes outside the confirmation block so it cannot conditionally execute based on user confirmation. No event currently exists inside the confirmation block afterModify()in Report "Copy Gen. Posting Setup".