How to make a filed NonEditable based on Enum value ?

Hi Friends,

i have a field the default status of field prop Allowtoedit → yes

as well as i have an enum. based on that enum value i want change the filed status is Editable & Non-Editable how can i do this…?

Any Help…

To achive this i wrote the fallowing code

Form → New Method →

void NoneditableFields()
Boolean enableMyField = true;
if(table.Enumfield != Enum::Enumvalue)
enableMyField = false;

i called the above method in form init method.

When i am opening the form it is working fine. but it should not effect on that filed when i change the enum value.


Try to write on edit method of an Enum. and assign the false value to allowEdit property of the field which you want to non Editable.

e.g. SalesQuotationTable_CustAccount.allowEdit(false);

You need to set the AllowEdit property to true or false through code based on the enum condition.

Please refer the following code in AX-
AOT->Forms->InventTable->setRFIDEnabled method

I wrote the above code in formDatasource → fileds–> Enumfiled -->Modified method.

now it is working fine…


Just Go through the design node of the form,and override the selection change method of the gender control.write the following code,

public int selectionChange()
int ret;

ret = super();

if(this.selection() == Gender::Male)

return ret;


  • change the auto declaration=yes in the property sheet of all the controls in your design.

It will sure work…