Using a form event handler to replace a lookup
This is a common requirement of an event handler, and deserves its own recipe. Prior to Update 3 in November 2016, these event handlers had to be placed in a utility class; we can now have a class that acts as an extension to the form's code-behind.
This was covered in the previous recipe, and if you are using this technique, the event handler should be written there without the static
keyword.
Getting ready
Ideally, we should have a form extension class written for this; otherwise, we just need a Dynamics 365 for Operations project open.
How to do it...
To add a custom lookup to a control on a standard form, please follow these steps
- Create a new class that could be a generic sales order utility class, or ideally a form extension class (see previous recipe for this).
Note
The naming is key so that we can easily find it. There is no obvious link that we have done this, so naming and documentation is critical.
- The first example is to make the sales order...