Thursday, April 30, 2015

Code for how to disable a fields of a form in ax 2012 based on enum value

FormèDatasourceèMethodsèselectionChanged()
public void selectionChanged()
{
   EmployeTable_s ETS; //declaring table
    ;
    super();
    ETS=EmployeTable_s;// declaring table= datasource of a form
// if (DatasourceName.EnumField == EnumName::EnumElement)  // Your Required Condition
        if(ETS.AccountStatus_s== AccountStatus_s::Inactive)
    {

        EmployeTable_s_EmpID.allowEdit(false); //Grid field names like (EmployeTable_s_EmpID),(EmployeTable_s_EmpName)
        EmployeTable_s_EmpName.allowEdit(false);
        EmployeTable_s_EmpID.enabled(false);
        EmployeTable_s_EmpName.enabled(false);
        EmployeTable_s_AccountStatus_s.allowEdit(false);
        EmployeTable_s_AccountStatus_s.enabled(false);
      
    }
    else
    {
        EmployeTable_s_EmpID.allowEdit(true);
        EmployeTable_s_EmpName.allowEdit(true);
        EmployeTable_s_EmpID.enabled(true);
        EmployeTable_s_EmpName.enabled(true);
        EmployeTable_s_AccountStatus_s.allowEdit(true);
        EmployeTable_s_AccountStatus_s.enabled(true);
      
    }




}


OP:

No comments:

Post a Comment

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...