code change · featureAL Developmentofficial - Microsoftreviewed - checked by Opus

#145 Process Context via manual event subscriber pattern

Adds community knowledge article documenting how to expose process context to extensions using manual event subscriber bindings tied to variable scope instead of singleton flags that persist across failed transactions.

Pull request · merged into main on 2026-09-02 by pri-kise · 3 files (+182 -0), 3 AL · feature · tier official · reviewed (checked by Opus)

What changed

  • A SingleInstance boolean is unsafe because it sits outside the transaction and stays true after a failed run
  • Recommended shape: a public query procedure backed by a local InternalEvent
  • The event is answered by an internal flag codeunit with manual subscriber instance, bound only for the run
  • Binding lifetime follows variable scope, so an error unwinds it; BindSubscription without UnbindSubscription is intended
  • Includes good and bad samples; inspired by the ZUGFeRD and PEPPOL DE context logic

AL objects touched

  • community/knowledge/events/expose-process-context-via-manually-bound-flag.bad.al: added, not in the BC? snapshot yet
  • community/knowledge/events/expose-process-context-via-manually-bound-flag.good.al: added, not in the BC? snapshot yet
  • community/knowledge/events/expose-process-context-via-manually-bound-flag.md: added, not in the BC? snapshot yet

Context

  • Systems: development
  • From the description: “A manual binding is the safe carrier: its lifetime is tied to a variable’s scope”

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).