In the previous recipe, we wrote our first JavaScript function and wired it manually. If you are going down the custom development path, always keep in mind future maintenance tasks. Rather than wiring your events manually through the user interface, consider doing it programmatically. Not only will that reduce the manual steps to configure your extensions, but it will also give you one location to view/maintain all the event wiring.
Wiring your event programmatically
Getting ready
In order to wire your event programmatically, you'll need a candidate function to wire (we will use the function from the previous recipe), an IDE to write your code, and, of course, access to a Dynamics 365 instance with the System Customizer or higher security role.
...