Friday, November 2, 2012

Copying License in Dynamics Ax


Axapta stores the License data in the following two tables.

1.SysLicenseCodeSort
2.SysConfig

So if you copy data of these tables(from Running instance) and import at your instance , this will serve your purpose.

Thursday, November 1, 2012

Temporary data insert



CustTable  CustTableTmp;
;
CustTableTmp.setTmp();
while select CustTable
{
    CustTableTmp.data(CustTable.data());
    CustTableTmp.doInsert();
}

Select CustTableTmp;

Wednesday, October 31, 2012

How to enable / disable form control through code in Ax 2009

Hi Friends,

I was designed new form for one of the functionality and while opening the form i suppose to set the properties of form controls. For this i  used the following line code.

1. Set the Auto Declaration property to true for that form control.
2. In the general methods of the form override the init() method.
3. In Init method after super() i used the following code line to set the properties
    
    element.control(control::ControlName).enabled(false);
    E.g. element.control(control::ToDate).enabled(false);

4. While writing this line of code you will not get any intellisense after Control::
     You have to just type your control name and compile the method and it's done.

Hope this will help anyone.

Kiss'shor.. :)

Monday, October 29, 2012

Date functions in AX 2009

Hi....

These are some of the functions,from where we can get the day or month or year from the date...
Here is the below example....

static void date_Functions(Args _args)
{
    Transdate    d;
    ;
    
    d = today();
    
    info(strfmt("Date - %1",d));
    
    //Gets the month for the given date...
    info(strfmt("Month - %1",mthofYr(d)));
    
    //Gets the month name from the given date...
    info(strfmt("Month Name - %1",mthname(mthofYr(d))));
    
    //Gets the day for the given date...
    info(strfmt("Day - %1",dayOfMth(d)));
    
    //Gets the day name from the given date...
    info(strfmt("Day Name - %1",dayname(dayOfMth(d))));
    
    //Gets the year for the given date...
    info(strfmt("Year - %1",year(d)));
    
    //Gets the current weekday number from the date...
    info(strfmt("Weekday number - %1",dayOfwk(d)));
    
    //Gets the day of the year from the given date...
    info(strfmt("Day of year - %1",dayOfyr(d)));
    
    //Gets the week of the year from the given date...
    info(strfmt("Week of the year - %1",wkofyr(d)));
}

Source : http://kollidynamics.blogspot.in/search?updated-max=2011-08-27T02:41:00-07:00&max-results=4&start=8&by-date=false

Sequence of methods in the FORM level in AX


Hi...

This gives the information of method calls in the form level while
1. Opening the Form.
2. Creating/Updating/Deleting the record in the Form.
3. Closing the Form.
Sequence of Methods calls while opening the Form
Form --- init ()
Form --- Datasource --- init ()
Form --- run ()
Form --- Datasource --- execute Query ()
Form --- Datasource --- active ()

Sequence of Methods calls while closing the Form
Form --- canClose ()
Form --- close ()

Sequence of Methods calls while creating the record in the Form
Form --- Datasource --- create ()
Form --- Datasource --- initValue ()
Table --- initValue ()
Form --- Datasource --- active ()

Sequence of Method calls while saving the record in the Form
Form --- Datasource --- ValidateWrite ()
Table --- ValidateWrite ()
Form --- Datasource --- write ()
Table --- insert ()

Sequence of Method calls while deleting the record in the Form
Form --- Datasource --- validatedelete ()
Table --- validatedelete ()
Table --- delete ()
Form --- Datasource --- active ()

Sequence of Methods calls while modifying the fields in the Form
Table --- validateField ()
Table --- modifiedField ()

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;
}