Hi everyone,
I have got a form that have got a MyFieldToEnable field that should not be editable. Also the form has got a enum-based control.
When the user changes the value of the enum-based control to certain value, then the fieldA should get editable.
I can put in the form init():
MyTable_ds.object(fieldnum(MyTable, MyFieldToEnable)).allowEdit(false);
and then in the modified of the MyTable.MyEnumFieldfield of the DS write
void modified()
{
MyTable_ds.object(fieldnum(MyTable, MyFieldToEnable)).allowEdit(MyTable.MyEnumField== MyEnumField::CertainValue);
}
, but on the control showing MyFieldToEnable field there is a property allowEdit. So instead of disabling the field on the init() I could just set allowEdit = false directly on the control and in the modified of the MyEnumField in DS in this case write:
void modified()
{
MyFieldToEnableControl.allowEdit(MyTable.MyEnumField== MyEnumField::CertainValue);
}
but I know it's not the best practice....
Why? What are the reasons for doing this on the control and minimising the number of lines of code to be written (that AX dev is aiming for usually)?
Thanks