How to do it...

To create a plugin using interfaces through metadata, follow these steps:

  1. First, create the interface, which is created as a class initially, using the following lines of code:
public interface ConWHSVehicleColorable {     public Color Color()     {     } } 
  1. We will need a class that implements this interface. Create a class named ConWHSVehicleGroupColorRed, which will simply return the string literal Red, as shown here:
class ConWHSVehicleGroupColorRed     implements ConWHSVehicleColorable {     public Color Color()     {         return 'Red';     } } 
  1. To keep logic away from the form and simplify usage, create a class named ConWHSVehicleGroupColorSetupForm.
  1. Next, create a static lookup method. The pattern should be familiar from the previous ...

Get Extending Microsoft Dynamics 365 for Operations Cookbook 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.