microsoft / microsoft/BCApps

[Event Request] Add PreviewMode parameter to Purchase Post events

Open
#8,910 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved event-request ext-ready-to-implement Team: SCM
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

Describe the issue

Some of the Purchase posting codeunit events do not have PreviewMode parameter in it.

This makes it harder for partner to prevent their code running if the posting is in PreviewMode.

We should add PreviewMode to any events that has SuppressCommit on below codeunit:

codeunit 90 "Purch.-Post"

Expected behavior

Here's an example on codeunit 90 "Purch.-Post"

internal procedure RunWithCheck(var TransferHeader2: Record "Transfer Header")
begin
...
OnAfterProcessPurchLines(PurchHeader, PurchRcptHeader, PurchInvHeader, PurchCrMemoHeader, ReturnShptHeader, WhseShip, WhseReceive, PurchaseLinesProcessed, SuppressCommit, EverythingInvoiced, PreviewMode);
...
...
OnAfterPostPurchaseDoc(PurchaseHeader2, GenJnlPostLine, PurchRcptHeader."No.", ReturnShptHeader."No.", PurchInvHeader."No.", PurchCrMemoHeader."No.", SuppressCommit, PreviewMode);
...
end;
[IntegrationEvent(false, false)]
local procedure OnAfterProcessPurchLines(var PurchHeader: Record "Purchase Header"; var PurchRcptHeader: Record "Purch. Rcpt. Header"; var PurchInvHeader: Record "Purch. Inv. Header"; var PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; var ReturnShipmentHeader: Record "Return Shipment Header"; WhseShip: Boolean; WhseReceive: Boolean; var PurchLinesProcessed: Boolean; CommitIsSuppressed: Boolean; EverythingInvoiced: Boolean; PreviewMode: Boolean)
begin
end;


[IntegrationEvent(false, false)]
procedure OnAfterPostPurchaseDoc(var PurchaseHeader: Record "Purchase Header"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; PurchRcpHdrNo: Code[20]; RetShptHdrNo: Code[20]; PurchInvHdrNo: Code[20]; PurchCrMemoHdrNo: Code[20]; CommitIsSupressed: Boolean; PreviewMode: Boolean)
begin
end;
Steps to reproduce

n/a

Additional context

ALAppExtensions/issues/27663

BusinessCentralApps/issues/1430

ADO GitHub Issue: #581951

I will provide a fix for a bug
  • I will provide a fix for a bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codeunit 90 "Purch.-Post" and inspect each event that uses SuppressCommit, including OnAfterProcessPurchLines and OnAfterPostPurchaseDoc. Trace their invocations and declarations, then verify that every applicable event exposes PreviewMode and that the application still compiles with existing subscribers.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.