AX / D365FO – How to Hide Enum values on a Form Lookup x++

 

Suppose you have a Form with an enum control ABC which contains values A,B,C. you want to hide last value of enum “C” while displaying it on the form.

You have 2 ways to reach the result :

Override the “Run” method in your Form (Preferred solution)

public void run()
{
    super();

    YourEnumControl.delete(enum2str(ABC::C));
}

Override the “Enter” method of that enum control at form level

public void enter()
{
   super();

   this.delete(enum2str(ABC::C));
}

Comments