Dynamics ax 2012 Form Field allow edit based on conditons

some times we may get requirements to make only some fields to be to allow edit on the form grid control.
Here are the few steps, which make is easy

1. Create a Form method as below

// This method is used to make fields editable based on conditions

public void setFieldAccess()
{
   if(XXXX == YYY)
   {
      FrmDataSource_ds.object(fieldNum(FrmDataSource,LineNum)).allowEdit(false);
   
      FrmDataSource_ds.object(fieldNum(FrmDataSource,Field2)).allowEdit(false);
    }
    //else
    //{
    //    FrmDataSource_ds.object(fieldNum(FrmDataSource,LineNum)).allowEdit(true);
        //    FrmDataSource_ds.object(fieldNum(FrmDataSource,Field2)).allowEdit(true);
        //}
}

2. Call the above method from the form Data source Active method after Super() as below

// to check record edit

public int active()
{
    int ret;
    ret = super();
    element. setFieldAccess();
    return ret;
}

tips:If you do it on a per-row basis you need to put an else

转自:http://axaptadevmallik.blogspot.com/2016/08/form-field-allow-edit-based-on-conditons.html?m=1

    标签: X++

    Danzel
    Danzel管理员

    • 声明:本文由Danzel于2020-11-05转载(优化),转载须经原站同意并注明出处。
    • 本文地址:http://maryd.cn/?id=128
    上一篇:How To: Refresh calling form
    下一篇:Hide ENUM values at run time

    留言评论

    暂无留言
    取消
    扫码支持