Create a lookup using an extension
Form lookups are nothing new in AX, and the patterns are the same in Dynamics 365. However sometimes we need to use a form extension which does not allow us to add a method directly on the form object. Instead we need to create an event against the form control to change the lookup. This can be a pain if the field is used in multiple locations but we must work with what we have.
To do this find your control and expand out the events:
Select the ‘OnLookup’ event and copy the event handle method. Next we need to create a class and then paste the text in. Finally we would write our code to perform the lookup as we would normally with the added step of cancelling the super call using the event args: