Skip to content

[Extensibility Request] issue 30420: add service post and send events - #10992

Open
Marko Aleksandric (AleksandricMarko) wants to merge 4 commits into
mainfrom
ai-ext-fix/ext_issue-30420
Open

Marko Aleksandric (AleksandricMarko) wants to merge 4 commits into
mainfrom
ai-ext-fix/ext_issue-30420

Conversation

@AleksandricMarko

@AleksandricMarko Marko Aleksandric (AleksandricMarko) commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Service integrations need to use Post & Send for Service Orders without copying codeunit 5979 or being limited to the standard Service-Post routine. This PR adds extension points that allow additional document types through confirmation and let subscribers safely replace posting or stop before sending when no posted document was created.

Source issue repository: microsoft/AlAppExtensions; issue number: 30420

Changes Made

  • Service-Post and Send.Code() - added pre-confirmation and pre-post integration events so extensions can support additional service document types and substitute posting while coordinating whether sending should continue.

Fixes AB#648196

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7fd29cf0-bf3b-4d3b-98f6-c1a286323ca8
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change adds two integration events to Service Post and Send. Subscribers can allow an additional service document type through confirmation, replace the standard posting call, and stop before sending when their posting path did not create a posted document.

The standard invoice and credit memo path is unchanged when there are no subscribers. The new flags separate handling the posting call from deciding whether the send phase should continue, which supports the requested extension scenario without changing an existing public signature.

Problem-solution fit

Fit: Strong

The requested behavior needs extension control before confirmation and before posting. The two events are placed at those points and expose the service header plus the control flags needed to keep or replace the standard flow.

Suggestions

No suggestions.

Risk assessment and necessity

Risk: Low. With no subscriber, supported document types still confirm, post, commit, and send as before. Subscribers can change that flow, but the new surface is additive and does not break existing events or procedures.

Necessity: The events are needed so extensions can use Post and Send for additional service scenarios without copying the codeunit. No test is required for the empty event publishers.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10992 round=1 by=alexei-dobriansky at=2026-09-17T12:52:00Z lastSha=ead00c375be2b1166078a4a0adfe84bba2d701c3 reviewKey=b2affab9fb2206d32e8dca72da5d6b7abdba21d0c6e0d88d9cb7ba7103586e9a suggestions=none

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes because SkipPost is currently honored even when the subscriber did not replace posting.

S1 - Honor SkipPost only for replacement posting. OnCodeOnBeforePost can set SkipPost := true while leaving PostIsHandled := false. The base app then runs Service-Post and immediately exits before OnAfterPostAndBeforeSend, Commit, and SendPostedDocumentRecord. This creates a posted-but-not-sent outcome and differs from the source request, where SkipPost is checked only inside the handled-posting branch.

Gate the early exit with PostIsHandled, or restore the requested nested flow: when PostIsHandled is false, always run standard posting and continue sending; when it is true, exit only if SkipPost is also true.

S2 - Add subscriber-contract tests. Cover base posting, replacement posting followed by sending, handled-without-posting exit, and the invalid PostIsHandled = false / SkipPost = true combination. This event controls a critical posting-and-send boundary and currently has no automated coverage.

The sole CI failure is work-item validation rather than a code or test failure.

attilatoury
attilatoury previously approved these changes Oct 13, 2026
Remove SkipPost and exit before standard posting and sending when the subscriber handles posting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 206c3a8e-61b7-42ba-8b98-dba77dc957f2
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Request Changes

What this PR does

The new commit simplifies the pre-post event from two control flags to one. A subscriber that handles posting now exits the codeunit before the existing send phase.

Status of previous suggestions

None - round 1 had no suggestions.

New observations (commits since round 1)

S1 (🔴 High): Handled posting can no longer continue to send
The requested flow needs a subscriber to replace posting and then continue to SendPostedDocumentRecord when it created a posted document. Keep separate controls for handling the standard post and for stopping before send; the current if PostIsHandled then exit makes that supported scenario impossible.

Risk assessment and necessity

Risk: High for the requested extension contract. A subscriber can either allow the standard posting routine or exit before sending, but cannot perform its own posting and continue through the standard send flow.

Necessity: The event request specifically requires separate posting replacement and send-suppression decisions so extensions do not need to copy the codeunit.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10992 round=2 by=alexei-dobriansky at=2026-10-15T06:11:16.9981954Z lastSha=fcb41618888789a87d8dac4f67b318c73965fef4 reviewKey=29688b11363e8e3e0d1ce2427193614f6488ae4051d7c13ef9f9d042e4d3830c suggestions=S1@ed0828eb:new parentRound=1

@alexei-dobriansky alexei-dobriansky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the suggestion.

Restore SkipPost and honor it only when a subscriber handles posting, allowing successful replacement posting to continue through the standard send flow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0a51aebd-dbfd-4a00-8fe7-6fb8c0812957
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Request Changes

What this PR does

The new commit restores separate controls for replacing posting and stopping before send. It fixes the previous early exit, but the replacement Service Order path still cannot make the existing send routine send the posted invoice.

Status of previous suggestions
ID Title Status Author response
S1 Handled posting can no longer continue to send Addressed The new code keeps separate handled and skip controls.
New observations (commits since round 2)

S2 (🔴 High): Replacement order still does not send
ServicePost.SendPostedDocumentRecord sends an Order only when its own Invoice flag is true. A subscriber that replaces posting cannot set that flag, so PostIsHandled = true and SkipPost = false reaches the send phase but sends no posted invoice. Pass explicit posting result state into the send path so it can send the created invoice.

Risk assessment and necessity

Risk: High for the new Service Order contract. Replacement posting can create and commit an invoice, but the following send call can silently do nothing because its local ServicePost instance has no invoice state. The standard Invoice and Credit Memo paths remain unchanged when no subscriber handles the new events.

Necessity: Supporting Service Orders without copying the codeunit is a valid need. The scope is small, but posting replacement and sending must work together end to end.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10992 round=3 by=alexei-dobriansky at=2026-10-16T18:06:24.4656810Z lastSha=f3175433f1cc342483d9f2746e18339690d7f72b reviewKey=cae23c6796c42b5bec4a072f1709eb5cf0c3ba5e7adcf0010773e7a6ec24d160 suggestions=S1@ed0828eb:addressed,S2@ed3d892b:new parentRound=2

This branch was successfully deployed

1 active (outdated) deployment
triage — ead00c37 Deployed Oct 12, 2026 by AleksandricMarko via Classify team ownership #7492
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-request SCM GitHub request for SCM area Team: SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants