Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition
by Simon Buxton
How it works...
This technique allows us to create our own events and is not restricted to tables. It can be used for classes and forms also. Delegates are straightforward enough: write a method stub as delegate void <MethodName> (<optional parameters>) and just call it in the code. If there are any subscribers, they will all be called—but in no particular order. This is why, in our example of the parameter class, we check whether it has already been handled before continuing.
We should always write delegates for anything we consider to be an event; another option could be delegates such as ServiceOrderCompleted and ServiceOrderCancelled. The aim here is to provide a method so that other developers, who may be working in a package that just ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access