jeudi 25 novembre 2010

How to assign a fixed value to a field in a datagrid of a form in Dynamics AX

When creating a new line in the datagrid , you want to assign a fixed value to a field from this datagrid,  you need to use the overrided method 'initValue' in the DataSource of your form as following for example: 

public void initValue()
{
    super();
    select firstonly PayrollPaytypeNum from payrollCompanyParameters;
    if (payrollCompanyParameters)
    {
        payrollPaytypeNum = payrollCompanyParameters.PayrollPaytypeNum;
    }
     PayrollCommonJournalTrans.PayrollPaytypeNum = payrollpaytypenum;
}

If you want to display in the grid specifics values you have just to override the method : executeQuery in you DataSource for example :
public void executeQuery()
{
    super();
    select empId from DropHoliday_1 join employee where employee.LogId == logId
                                     && employee.EmpId == DropHoliday_1.EmpId;
}


Happy Daxing!

Aucun commentaire:

Enregistrer un commentaire