Skip to content

v1.0.0

Choose a tag to compare

@skfd skfd released this 17 Aug 22:45
· 23 commits to main since this release

First public release of Events2Code, an XrmToolBox tool that converts Dynamics 365 form event handler registrations made in the form designer into an equivalent JavaScript OnLoad bootstrap — and then unregisters them from the form.

What it does

  • Browse a table's Main and Quick Create forms and list every handler registered through the form designer, with its event, target, function, library, extra parameters, execution-context flag, and enabled state.
  • Generate a single OnLoad bootstrap that registers the checked handlers through the Client API — addOnSave, addOnChange, addTabStateChange, addOnLoad for subgrids — with original form OnLoad handlers called directly. Lookups are guarded with ?., so a field, tab, or grid missing from the current form variant is skipped instead of throwing and killing every registration after it.
  • Preserve designer quirks: extra parameters and the "pass execution context" flag come back as wrapper closures, disabled handlers are emitted commented out, and anything not convertible is listed as a comment at the bottom of the file.
  • Unregister the checked handlers: strip them from the form XML, register the bootstrap on form OnLoad, add its web resource to the form libraries, update the form, and publish the table.
  • Back up the form XML to Documents\Events2Code\backups before any change, warn on managed forms, and never touch handlers Dynamics owns (<InternalHandlers>).

Install

  • XrmToolBox Tool Library — search for Events2Code and install it.
  • Manually — download Events2Code.dll below, copy it into your XrmToolBox Plugins folder, and restart XrmToolBox.

Requires XrmToolBox 1.2025.7+, .NET Framework 4.8, and a connection whose user can update forms and publish customizations.

Caveats

  • The generated output is ES2020 (optional chaining). Fine for Unified Interface; check any minifier or ESLint config pinned to ES5.
  • A subgrid on a collapsed or non-default tab is not instantiated at form OnLoad, so its registration is skipped at runtime — move that one into the owning tab's state change handler by hand.
  • Upload the web resource containing the generated code before unregistering, or the form briefly has no working scripts.

Documentation · Changelog