How to do it...

To create a new lookup handler event, follow these steps:

  1. Since this handles the lookup event on the SalesTable form, create a class named SalesTable_ConVehicleManagement_FormHandler.
  2. Open the SalesTable form design, and expand Data Sources, SalesLine, and then ItemId.
You will see there is no lookup event here, which means we can't override the lookup so that all controls based on this field will be affected. We can't use the Chain of Command on the lookup method because it does not support nested objects, and this forces us to override the lookup at the control level.
  1. Next, find the SalesLineGrid grid control, and expand the SalesLine_ItemId control to see the events that it has.
  2. Right-click on OnLookup and choose Copy ...

Get Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.