Monday, October 29, 2012

How to Create a new “Parameters form” for New Module developed in AX


How to develop a new “Parameters form” in case of New Module developed in AX.
We go through it by considering an example of creating the new module as Payroll.
So now we will create the Payroll Parameters setup form for the payroll module.
Initially create a Parameters table for the Module, the naming convention should be the Module name followed by Parameter as in this case it is PayrollParameters table….and need to have the fields accordingly what is required in the Parameters table.
Set the following properties for the parameter table as…

Create a parameter form by considering the PayrollParameters andNumberSequenceReference as data sources. And set the following properties for the data source in the form level as

First thing is that there shouldn’t be any provision to create the record in the parameters form. The record in the Parameters should be by default and it can be updated as per the functionality required
So when creating the new company in the Axapta, the parameters form should have the default values.
To have the default values in the parameters we need to have the following code in the table  level of find() of PayrollParameters tables .
static PayrollParameters find(boolean _forupdate = false)
{
    PayrollParameters  parameter;

    if (_forupdate)
    parameter.selectForUpdate(_forupdate);

    select firstonly parameter
        index Key
        where parameter.Key == 0;

    if (!parameter && !parameter.isTmp())
    {
        Company::createParameter(parameter);
        NumberSeqReference::construct(PayrollParameters::numberSeqModule()).load();
    }

    return parameter;
}

No comments:

Post a Comment