Accessing datasource field properties

From Axaptapedia

Often it is useful to be able to access the datasource field properties on a form through X++. This is essential for modifying the allowEdit property at run-time for example.

The following code can be used to set the allowEdit of the InventTable.ItemName field on a form.

FormDataObject  fldItemName;
boolean         allowEdit = false; //This would set according to some criteria
 
fldItemName = inventTable_DS.object(FieldNum(InventTable,ItemName));
fldItemName.allowEdit(allowEdit);

Download this project for an example form showing this technique.