Monday, December 26, 2016

Hide Enum values in Form Control in AX


Hide Enum values in Form Control :
Well there are various situations where you  want to show only subset of Enum values :
How to do it :
Well add below , In Class declaration of form
public class FormRun extends ObjectRun
{
    SysFormEnumComboBox         sysFormEnumComboBox;
    Set                         enumSet;// = new Set(Types::Enum);
}

Add below piece of code in Form’s init method :
public void init()
{
    enumSet= new Set(Types::Enum);
    enumSet.add(Enum::A);
    enumSet.add(Enum::B);
    enumSet.add(Enum::C);
    enumSet.add(Enum::D);
   
    sysFormEnumComboBox  = sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(Form,control)),enumNum(enum),enumSet);
    super();
  
}

No comments:

Post a Comment