Wednesday, 10 August 2016

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
///
///
/// 10/08/2016 by mallik
///

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

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

///
/// to check record edit
///
///
/// int
///
///
///  09/08/2016 by Mallik
///

public int active()
{
    int ret;

    ret = super();
    element. setFieldAccess();

    return ret;
}

No comments:

Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++

  Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...