Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Form utils

X++

Snippet collection

Snippets

The following snippet can be used to set the allowEdit property on all the fields in a form datasource.

[DataSource]
class ExampleDataSource
{
    public void setAllowEditOnAllFields(boolean _allowEdit)
    {
        DictTable dictTable = new DictTable(tableNum(ExampleDataSource));
        FieldId fieldId;

        fieldId = dictTable.fieldNext(0);
        while (fieldId)
        {
            FormDataObject formDataObject = this.object(fieldId);
            if (formDataObject)
            {
                formDataObject.allowEdit(_allowEdit);
            }
            
            fieldId = dictTable.fieldNext(fieldId);
        }
    }
}