Running Batch Job from X++ example code

static void TID_ExecuteBatchJobDistribution(Args _args)
    BatchHeader header;
    SysRecurrenceData sysRecurrenceData;
    Batch batch;
    BatchJob batchJob;
    RetailConnScheduleRunner _RetailConnScheduleRunner; // Class extends RunBaseBatch
    BatchInfo processBatchInfo;
    BatchRetries noOfRetriesOnFailure = 4;

    // Setup the RunBaseBatch Job
    header = BatchHeader::construct();
    _RetailConnScheduleRunner = new RetailConnScheduleRunner();
    processBatchInfo = _RetailConnScheduleRunner.batchInfo();
    processBatchInfo.parmCaption(_RetailConnSchedule.Name); // Description Batch Job
    processBatchInfo.parmGroupId('RTL'); // Batch Gorup

    // Set the recurrence data
    sysRecurrenceData = SysRecurrence::defaultRecurrence();
    SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData, DateTimeUtil::addSeconds(DateTimeUtil::utcNow(), 20)); // Set range of recurrence
    SysRecurrence::setRecurrenceUnit(sysRecurrenceData, SysRecurrenceUnit::Minute); // Set reccurence pattern
    // Set the batch alert configurations
    header.parmAlerts(NoYes::No, NoYes::Yes, NoYes::No, NoYes::Yes, NoYes::Yes);;

    // Update the frequency to run the job to every two minutes
    select forupdate batchJob
    join batch
    where batchJob.RecId == batch.BatchJobId
    && batch.ClassNumber == classnum(RetailConnScheduleRunner);

    sysRecurrenceData = batchJob.RecurrenceData;
    sysRecurrenceData = conpoke(sysRecurrenceData, 8, [10]);
    batchJob.RecurrenceData = sysRecurrenceData;

New contributors for hellodax !!

Hi there,
i’m Sti Fanddy Cavendish and working as AX Technical Consultant/Devoper. As far as i can remember, i started this blog just to write down my code so i dont have to spend more times to googling code that i had written. Now as Dynamics AX keep progressing, and the market expand more broader. The demand for x++ code and technical matters related to dynamics AX is much higher than few back years earlier. So i invited some of the best active AX Technical Consultant / Developer on Indonesia to joined this blog as new contributors. Hope they can share they experience regarding AX Technical.

Below are the new contributors for this blogs  :


Bagus Pramana (Author id : xylonitefuma) is an Senior AX Technical Consultant, his expertise on AX Retail, Architecture and AX POS customization is considered one of the best on the region.

Harrison Sibuea (Author id: atus) is an Senior AX Technical Consultant, his expertise on AX Customization on AX 2009, AX 2012. And and expert on AX Maintenance Support.

and last, the new Rookie , Randa Oktendy (Author id: axrokt) is an AX Developer , his expertise on AX and Report (SSRS) customization.

You can view all their linkedin profile on the Contributors section in this blog.  (

Thank you and happy daxing !!



How to access AX 7 from other machine (preview VM Version : AX7 Update 1)

version : AX7 Update 1.
When we need multiple users to test the new AX7 , it’s imposible to ask everyone to run VM on their local because not everyone have the specs to run the VM. So what i do is to make AX7 available on local network so our team can test its new features.

Step by step how to do it :
1. Setup network Bridged Adapter on VM settings


2. setup your network ip on inside your VM,  (cmd : ipconfig /all on host machine to view ip config)

3. Edit your local host file on C:\Windows\System32\drivers\etc . add AX 7 VM IP and


4. Copy and install SSL certificate from VM to avoid HTTPS error when open the link. How to copy certificate : open IIS -> Website (AOSServiceDSC) -> Site Binding (on right pane) -> Edit Site Binding -> View SSL Certificate -> Details -> Copy to file .


5. install SSL certificate from VM to avoid HTTPS error when open the link. How to install certificate on the chrome.  url help link:—windows-using-chrome


6. Now open your browser, and open the ax 7 at url at , login using your credential, and voila !! done..


marking inventTrans example code

public static void FNDMarkInventTrans(InventTransId _inventTransId,InventTransId _refInventTransId,InventQty _qtyTomark)
    InventTrans issueInventTrans;
    TmpInventTransMark tmpInventTransMask;
    Map mapMarkNow;
    container con;
    real qty;
    Map mapTmp;
    MapEnumerator mapEnumerator;

    InventTransOriginId issueInventTransOriginId =

    InventTransOriginId receiptInventTransOriginId =

    InventQty qtyToMark = _qtyTomark;


    issueInventTrans = InventTrans::findByInventTransOrigin(

    [con, qty] = TmpInventTransMark::packTmpMark(

    mapTmp = Map::create(con);
    mapEnumerator = mapTmp.getEnumerator();
    while (mapEnumerator.moveNext())
        tmpInventTransMask = mapEnumerator.currentValue();

        if (tmpInventTransMask.InventTransOrigin == receiptInventTransOriginId)
            tmpInventTransMask.QtyMarkNow = qtyToMark;
            tmpInventTransMask.QtyRemain -= tmpInventTransMask.QtyMarkNow;
            mapMarkNow = new Map(Types::Int64, Types::Record);
            mapMarkNow.insert(tmpInventTransMask.RecId, tmpInventTransMask);



reference code :