Repository navigation
Releases: comentality/xrm-events-2-code
Release list
v1.1.1
Added
-
An About button on the toolbar now shows which build you have and where to report what is
wrong. It sits at the right end, with the Comentality mark in front of the word. The box
has the tool's page, its release notes and its source, and Copy diagnostics puts your versions
on the clipboard to paste into a mail. XrmToolBox's own About entry opens the same box. When
the tool is docked narrow the button takes the line above the status, so the buttons and the
text boxes keep the room they had. -
tests\Events2Code.Tests, which checks what the tool hands the About box and needs no
environment.ui.ps1 -Scene aboutphotographs the box, and every other run now fails if the
button leaves the right edge or lands on anything. Its shots no longer come out with
controls as blank white boxes.
v1.1.0
Fixed
- Changing the connection now clears the old environment from the window, so no write can land in the wrong one. Anything still loading from the old connection is thrown away instead of filling the new window. The last environment's tables, forms and handlers all go. The form left selected across a change was the dangerous part: its id is what Unregister and Generate write back to, so a write meant for one environment could land in another.
- On a slow connection the forms list and handler grid always show what you clicked last, and the buttons wait for it. Load Tables, Generate, Save and Unregister stay disabled until what they act on has arrived, so Unregister can no longer run twice on one form. They come back when it lands or fails. Clicking through tables or forms used to leave the slower answer on screen under a newer selection, so the grid described one form while everything acting on it pointed at another. Two presses of Unregister used to be two rewrites of the same form, the second taking as its "before" state a form the first had already stripped — so the backup meant to be the way back was a copy of the damage.
- Loading tables, forms and a form's XML can now be cancelled from the Cancel button on the loading panel. The tool never offered one before. Cancelling says so and leaves nothing stuck.
- A failed load now stays on the status line, which also says what is still loading instead of counting too early. A table list that could not be read no longer looks like an environment with no tables. A table whose forms could not be read no longer shows the previous table's forms, and the failure can still be read after the dialog is gone. The status line no longer counts handlers of a form that is still loading: "No handlers registered on this form" is now a statement about a form the tool has read.
- Closing the tab mid-load no longer pops up an error later, and a save to a dead share no longer freezes the window. Closing the tab mid-fetch used to put an error dialog up afterwards, over whatever you had moved on to. Saving the generated file now happens off the UI thread.
Changed
- The tool's home is now comentality.com/tools: the package page's project link goes there, and the README says so. The source and these notes stay on GitHub.
Added
tests\slow.ps1, a harness that drives the real control against a Dataverse that takes seconds to answer: eleven scenarios, a screenshot per gesture, and a line per finding. Every fix above but the save has one that failed before it.
Install
- XrmToolBox Tool Library — search for Events2Code and install or update it.
- Manually — download
Events2Code.dllbelow, copy it into your XrmToolBoxPluginsfolder, and restart XrmToolBox.
Requires XrmToolBox 1.2025.7+, .NET Framework 4.8, and a connection whose user can update forms and publish customizations.
v1.0.0
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,addOnLoadfor 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\backupsbefore 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.dllbelow, copy it into your XrmToolBoxPluginsfolder, 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.
