Skip to content

[Extensibility Request] issue 30337: add OnCreateProdOrderLineOnBeforeCreateProdOrderLineFromItem event#9441

Draft
AleksandricMarko wants to merge 2 commits into
mainfrom
ai-ext-fix/ext_issue-30337
Draft

[Extensibility Request] issue 30337: add OnCreateProdOrderLineOnBeforeCreateProdOrderLineFromItem event#9441
AleksandricMarko wants to merge 2 commits into
mainfrom
ai-ext-fix/ext_issue-30337

Conversation

@AleksandricMarko

@AleksandricMarko AleksandricMarko commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The issue author needs to completely replace the standard Source Type = Item processing in CreateProdOrderLine under specific business conditions, executing their own production order line creation and controlling the resulting ErrorOccured outcome. None of the existing events (OnCreateProdOrderLineOnBeforeInitProdOrderLine, OnBeforeProdOrderLineInsert, OnAfterProdOrderLineInsert, OnAfterCreateProdOrderLine) can bypass the standard flow. This PR adds an IsHandled-based integration event that lets an extension take full ownership of the item-line creation and set ErrorOccured.

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

Changes Made

  • CreateProdOrderLine (codeunit 99000787 "Create Prod. Order Lines") - extracted the standard Source Type = Item branch into a new local procedure CreateProdOrderLineFromItem and raised a new OnCreateProdOrderLineOnBeforeCreateProdOrderLineFromItem integration event with var IsHandled and var ErrorOccured before calling it, so subscribers can replace the standard item-line creation and report the outcome; when IsHandled stays false the original behavior and all existing events are preserved.
  • OnCreateProdOrderLineOnBeforeCreateProdOrderLineFromItem - new [IntegrationEvent(false, false)] publisher exposing IsHandled, ErrorOccured, the Production Order record, and the variant code.

Fixes AB#641918

…LineFromItem event

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AleksandricMarko AleksandricMarko added event-request SCM GitHub request for SCM area labels Jul 14, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 14, 2026
OnAfterCreateProdOrderLine(ProdOrder, VariantCode, ErrorOccured);
end;

local procedure CreateProdOrderLineFromItem(ProdOrder: Record "Production Order"; VariantCode: Code[10]; var ErrorOccured: Boolean)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot ProdOrder: Record "Production Order" should be with var and renamed to ProductionOrder

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.

Updated in 20e7f28: CreateProdOrderLineFromItem now uses var ProductionOrder: Record "Production Order", and the internal references were renamed from ProdOrder to ProductionOrder.

@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-request needs-approval Workflow runs require maintainer approval to start SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants