[Extensibility Request] issue 30362: add OnPostDocumentLinesOnBeforeInsertPostedHeaders event to Service-Post - #9778
[Extensibility Request] issue 30362: add OnPostDocumentLinesOnBeforeInsertPostedHeaders event to Service-Post#9778AleksandricMarko wants to merge 1 commit into
Conversation
…rs event to Service-Post Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
qasimikram
left a comment
There was a problem hiding this comment.
S1 - The new IsHandled path is unsafe because it skips Serv-Documents Mgt. preparation, which initializes temporary posted headers, journal document parameters, logs, comments, and incoming-document state. The subscriber only receives ServiceHeader and document-number variables, so it cannot initialize the same codeunit instance before PostDocumentLines and finalization consume that state. Please narrow the extension point or expose a safe replacement contract, and add a subscriber-path test covering posted headers, lines, and journal document numbers.
S2 - Pass ServiceHeader by value unless a specific late-mutation contract is required and tested. The equivalent Sales-Post event uses a value parameter, and var permits mutation after posting checks and initialization.
Summary
The reporter builds solutions with custom Service document types and needs to control which posted document is created during Service posting. Codeunit 5980
Service-Postcurrently hardcodes the decision of whether a posted service invoice or credit memo header is created, so extensions cannot alter this flow the way they can in Sales-Post. This PR adds anIsHandledintegration event immediately before that logic, bringing Service-Post extensibility in line with Sales-Post.Source issue repository: microsoft/AlAppExtensions; issue number: 30362
Changes Made
OnPostDocumentLinesOnBeforeInsertPostedHeaders- newIsHandledintegration event raised inPostDocumentLinesright before the posted service invoice/credit memo header creation, letting subscribers replace the standard decision; the same change is propagated to the NA and IT layer counterparts.Fixes AB#643301