bcquality/microsoft/knowledge/events
waldo b7617fb48a
knowledge(events): ChangeCompany leaves triggers and trigger-event subscribers running in the calling company (#152)
* knowledge(events): ChangeCompany leaves triggers and trigger-event subscribers running in the calling company

ChangeCompany redirects only the data access of a record variable; Learn states that triggers still run in the current company. The database trigger events are raised on every database operation and only pass RunTrigger to the subscriber, so Insert(false) after ChangeCompany still runs every subscriber in the calling company. Generated code either assumes the record 'becomes' a target-company record, or switches RunTrigger off and hand-copies the trigger logic, leaving the subscribers writing to the wrong company; none of the tested runs reached StartSession with the company parameter.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* knowledge(events): qualify StartSession async semantics and fix concurrency-unsafe sample key

Addresses PR #152 review: StartSession is a fire-and-forget background
session (Ok reports only whether it started, not whether the codeunit
succeeded, and errors inside it do not propagate), so the Best Practice
now scopes the recommendation and calls out the durable status/error
channel a synchronous-success write needs. The good sample's
FindLast()+1 entry-number pattern raced under concurrent background
sessions; switched to AutoIncrement, which the platform guarantees is
unique across concurrent transactions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* knowledge(events): serialize the setup-counter increment; promote article and wire the review skill

PR #152 round 3 (JesperSchulz):
- The good sample's OnAfterInsertEvent subscriber still raced on the
  shared "Transfer Setup Good" singleton (Get/increment/Modify);
  AutoIncrement only protected the request key. Added
  TransferSetup.LockTable() before Get() to serialize concurrent
  background sessions.
- Promoted changecompany-runs-triggers-in-the-calling-company from
  community/knowledge/events/ to microsoft/knowledge/events/, and wired
  ChangeCompany/StartSession/RunTrigger tokens plus a targeted
  detection cue into microsoft/skills/review/al-events-review.md so a
  diff containing the anti-pattern reliably worklists this article,
  preserving the documented RunTrigger=false hand-off exception.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: waldo1001 <12088142+waldo1001@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:34:28 +02:00
..
add-new-event-parameters-at-the-end.bad.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
add-new-event-parameters-at-the-end.good.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
add-new-event-parameters-at-the-end.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
adding-a-parameter-to-an-event-is-not-a-breaking-change.md Add FP guards for field relocation to tableextension and event parameter addition 2026-08-04 10:41:03 +02:00
avoid-loosely-typed-event-parameters.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
avoid-loosely-typed-event-parameters.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
avoid-loosely-typed-event-parameters.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
avoid-raising-events-inside-try-functions.bad.al Avoid Public Event publisher (#144) 2026-09-02 16:07:18 +02:00
avoid-raising-events-inside-try-functions.good.al Avoid Public Event publisher (#144) 2026-09-02 16:07:18 +02:00
avoid-raising-events-inside-try-functions.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
changecompany-runs-triggers-in-the-calling-company.bad.al knowledge(events): ChangeCompany leaves triggers and trigger-event subscribers running in the calling company (#152) 2026-09-15 12:34:28 +02:00
changecompany-runs-triggers-in-the-calling-company.good.al knowledge(events): ChangeCompany leaves triggers and trigger-event subscribers running in the calling company (#152) 2026-09-15 12:34:28 +02:00
changecompany-runs-triggers-in-the-calling-company.md knowledge(events): ChangeCompany leaves triggers and trigger-event subscribers running in the calling company (#152) 2026-09-15 12:34:28 +02:00
choose-static-vs-manual-subscribers-deliberately.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
choose-static-vs-manual-subscribers-deliberately.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
choose-static-vs-manual-subscribers-deliberately.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
declare-event-publishers-local-or-internal.bad.al Promote knowledge for Microsoft review skills (#153) 2026-09-03 15:06:01 +02:00
declare-event-publishers-local-or-internal.good.al Promote knowledge for Microsoft review skills (#153) 2026-09-03 15:06:01 +02:00
declare-event-publishers-local-or-internal.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
do-not-add-ishandled-to-an-existing-event.bad.al Fix lifecycle compatibility guidance (#93) 2026-07-14 11:26:16 +02:00
do-not-add-ishandled-to-an-existing-event.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
do-not-add-ishandled-to-an-existing-event.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
do-not-bypass-critical-operations-with-ishandled.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
do-not-bypass-critical-operations-with-ishandled.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
do-not-bypass-critical-operations-with-ishandled.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
do-not-change-shipped-event-attribute-flags.bad.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
do-not-change-shipped-event-attribute-flags.good.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
do-not-change-shipped-event-attribute-flags.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
do-not-publish-events-inside-loops.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
do-not-publish-events-inside-loops.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
do-not-publish-events-inside-loops.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
expose-process-context-via-manually-bound-flag.bad.al Promote knowledge for Microsoft review skills (#153) 2026-09-03 15:06:01 +02:00
expose-process-context-via-manually-bound-flag.good.al Promote knowledge for Microsoft review skills (#153) 2026-09-03 15:06:01 +02:00
expose-process-context-via-manually-bound-flag.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
name-event-parameters-without-abbreviations.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
name-event-parameters-without-abbreviations.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
name-event-parameters-without-abbreviations.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
name-events-by-publisher-position.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
name-events-by-publisher-position.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
name-events-by-publisher-position.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
prefer-reusing-or-extending-existing-events.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
prefer-reusing-or-extending-existing-events.good.al Fix lifecycle compatibility guidance (#93) 2026-07-14 11:26:16 +02:00
prefer-reusing-or-extending-existing-events.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
prefer-this-over-includesender-in-codeunit-events.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
prefer-this-over-includesender-in-codeunit-events.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
prefer-this-over-includesender-in-codeunit-events.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
prefix-temporary-record-event-parameters-with-temp.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
prefix-temporary-record-event-parameters-with-temp.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
prefix-temporary-record-event-parameters-with-temp.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
preserve-onafter-execution-when-ishandled-skips-the-body.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
preserve-onafter-execution-when-ishandled-skips-the-body.good.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
preserve-onafter-execution-when-ishandled-skips-the-body.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
publish-thin-onbefore-onafter-integration-events.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
publish-thin-onbefore-onafter-integration-events.good.al Fix lifecycle compatibility guidance (#93) 2026-07-14 11:26:16 +02:00
publish-thin-onbefore-onafter-integration-events.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
reset-ishandled-only-when-the-value-can-carry-over.bad.al Align the IsHandled article slug, keywords and good sample with its narrowed scope 2026-09-02 11:08:16 +02:00
reset-ishandled-only-when-the-value-can-carry-over.good.al Align the IsHandled article slug, keywords and good sample with its narrowed scope 2026-09-02 11:08:16 +02:00
reset-ishandled-only-when-the-value-can-carry-over.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
treat-local-and-internal-events-as-subscriber-contracts.bad.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
treat-local-and-internal-events-as-subscriber-contracts.good.al Add P0 event and interface compatibility knowledge (#98) 2026-07-14 12:51:59 +02:00
treat-local-and-internal-events-as-subscriber-contracts.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00
use-ishandled-to-make-base-behaviour-overridable.bad.al Add events knowledge domain and review leaf skill (#43) 2026-06-25 12:24:25 +02:00
use-ishandled-to-make-base-behaviour-overridable.good.al Fix lifecycle compatibility guidance (#93) 2026-07-14 11:26:16 +02:00
use-ishandled-to-make-base-behaviour-overridable.md Improve partner onboarding and documentation navigation (#174) 2026-09-09 17:31:03 +02:00