Dynamics Ax Disable / Enable all datasource fields
April 28th, 2009
No comments
Sometimes you want to disable all fields on a form’s datasource and enable some of them afterwards. Put the following piece of code in the Global class and you can call it from wherever you like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public static void LIBSetAllTableFields(FormDataSource _formDataSource,Boolean _value) { DictTable dictTable = new DictTable(_formDataSource.table()); int i; int fieldNumber; ; for(i = 1;i < = dictTable.fieldCnt();i++) { fieldNumber = dictTable.fieldCnt2Id(i); if(_formDataSource.object(fieldNumber)) { _formDataSource.object(fieldNumber).allowEdit(_value); } } } |