Sunday, May 28, 2017

Batch Process from AX job x++

static void BatchProcessJob(Args _args)
{
    BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str ParmCaption = "test Process job";
    SysRecurrenceData     sysRecurrenceData = SysRecurrence::defaultRecurrence();   
    ;
    rbbTask = new CDataDownloadprocess();
//sysRecurrenceData = SysRecurrence::setRecurrenceEndAfter(sysRecurrenceData, 3);
    sysRecurrenceData = SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData,DateTimeUtil::newDateTime(mkDate(28,03,2017),str2time("07:30")));
    sysRecurrenceData = SysRecurrence::setRecurrenceNoEnd(sysRecurrenceData);
    sysRecurrenceData = SysRecurrence::setRecurrenceUnit(sysRecurrenceData,SysRecurrenceUnit::Day,1);
    batInfo = rbbTask.batchInfo();
    //rbbTask.run();
    batInfo.parmCaption(ParmCaption);
    batInfo.parmGroupId("");
    batHeader = BatchHeader ::construct();
    batHeader.addTask(rbbTask);
    batHeader.parmRecurrenceData(sysRecurrenceData);
    batHeader.save();
    info(strFmt("'%1' batch scheduled.", ParmCaption));
    /*BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str sParmCaption = "Process job";
    ;
    rbbTask = new CDataDownloadprocess();
    batInfo = rbbTask.batchInfo();
    batInfo.parmCaption(sParmCaption);
    batInfo.parmGroupId("");
    batHeader = BatchHeader ::construct();
    batHeader.addTask(rbbTask);
    batHeader.save();
    info(strFmt("'%1' batch scheduled.", ParmCaption));*/
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...