Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Monday, August 5, 2013

Retrieving / getting System Date and time in Dynamic AX

Hi,

        TableName.FieldName= DateTimeUtil::getSystemDateTime();
or
         StringEditName = DateTimeUtil::getSystemDateTime();

Regards,

Validating two date fields in Dynamic AX

Hi,

1.Create two fields as UtcDateTimeEdit of table TableName
2.Name it InTime and OutTime.
3.In the init() of that datasource or form depends on requirements.

    TableName.InTime = DateTimeUtil::getSystemDateTime();
    TableName.OutTime = DateTimeUtil::getSystemDateTime();
//here making the system date and time to the that field.

3.Override the modified method by modified each of the fields.

public boolean modified()
{
    boolean ret;

    ret = super();

    if(SMAServiceOrderTable.InTime > SMAServiceOrderTable.OutTime)
    {
        warning("In time cannot be greater than Out time");
        SMAServiceOrderTable.InTime = DateTimeUtil::getSystemDateTime();
        SMAServiceOrderTable.OutTime = DateTimeUtil::getSystemDateTime();
    }

    return ret;
}

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...