Alfasith AX

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

Monday, December 23, 2019

DateTime Handlings in AX 2012 / D365

static void AlfTimeAdd(Args _args)
{
    TransDateTime    d = DateTimeUtil::getSystemDateTime();
    TransDate       d3 = today();
    TransDateTime    d1,d2;
    ;
    print d;
    print d3;
    d1 = DateTimeUtil::addHours(d,4); // To add 4 hours from current time
 
    print d1;
    d2 = Datetimeutil::newDateTime(d3,7.5*60*60); // I need today 7.30 Am
    print d2;
 
    print DateTimeUtil::addHours(d,4);
    print DateTimeUtil::addDays(d,4);
    print DateTimeUtil::addMinutes(d,4);
    print DateTimeUtil::addMonths(d,4);
    print DateTimeUtil::addYears(d,4);
     
    pause;
}

static void AlfaTime(Args _args)
{
    str t = "25 12 2019 10:06:00 AM";
    str t1 = "25/12/2019 10:06:00 AM";
    str t2 = "25-12-2019 10:06:00 AM";
    str t3 = "25-Dec-2019 10:06:00 AM";
    ;
    print str2datetime(t,123);
    print str2datetime(t1,123);
    print str2datetime(t2,123);
    print str2datetime(t3,123);
    print  str2datetime("2 25 1985 11:04:59 pm" ,213 );
    pause;

}

Saturday, December 21, 2019

X++ Code to handle workflow event hander for current record

Hi

public void changeRequested(WorkflowElementEventArgs  _workflowElementEventArgs)
{
    ttsbegin;

    DpayWorkerReqTable::findRecId(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), true));
    DpayWorkerReqTable.Status = DpayWorkflowStatus::NotSubmitted;
    DpayWorkerReqTable.update();
    ttscommit;
}

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) ...