[W1][Report][87][Copy - General Posting Setup] Add integration event OnAfterConfirmAndModify in the General Posting Setup dataitem OnAfterGetRecord trigger after Modify.
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".
Internal work item: AB#646562
✅ Analysis complete - ready for further processing
Implementation:
Add a new integration event in the General Posting Setup dataitem OnAfterGetRecord trigger of Report "Copy - General Posting Setup" immediately after Modify() inside the confirmation block.
Location in OnAfterGetRecord trigger:
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 begin
Modify();
OnGeneralPostingSetupOnAfterGetRecordOnAfterConfirmAndModify("General Posting Setup", GenPostingSetup);
end;
end;
Event Publisher (add at the end of the codeunit with other events):
[IntegrationEvent(false, false)]
local procedure OnGeneralPostingSetupOnAfterGetRecordOnAfterConfirmAndModify(var ToGeneralPostingSetup: Record "General Posting Setup"; FromGeneralPostingSetup: Record "General Posting Setup")
begin
end;
File: CopyGeneralPostingSetup.Report.al
[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.
[!TIP] Not accurate? Reply with
/not-accurate(optional: add a short explanation). Your feedback improves future responses.
:robot: AI triage completed. Product group, please validate the triage report (Microsoft internal access only, use Ctrl+Click to open in new tab).
Was this triage helpful? React with :thumbsup: or :thumbsdown: on this comment to provide feedback.
Hi @mavohra,
Thank you for your extensibility request.
We couldn't locate the specified procedure/trigger in the codebase.
Target: OnAfterGetRecord in Report "Copy Gen. Posting Setup" (dataitem "General Posting Setup")
Please verify the procedure/trigger name and update the issue. We'll automatically re-analyze once updated.
[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.
[!TIP] Not accurate? Reply with
/not-accurate(optional: add a short explanation). Your feedback improves future responses.
/not-accurate
✅ Feedback recorded
Thanks — your /not-accurate feedback has been logged and will be reviewed.
Awaiting feedback
New event to be added:
Target: OnAfterGetRecord in Report "Copy Gen. Posting Setup" (dataitem "General Posting Setup")
if ConfirmManagement.GetResponseOrDefault(Text000, true) then begin
Modify();
OnAfterGetRecordOnGeneralPostingSetupOnAfterConfirmAndModify("General Posting Setup", GenPostingSetup);
end;
end;
Fixed