Tuesday, 28 November 2017

Batch job in AX7 / D365 x++ code

In AX7 / D365 batch jobs are created pretty same as we did in AX2012. Below mention is the code snippets that shows how to create a batch class.




After that all we need to do is to create Action menu item and assign class name in its object property and set Object type to Class. That is all you need to do for creating a batch job.

4 comments:

  1. Hi please help with this, EgxConstants does not recognize me in the if of the catch (Exception :: UpdateConflict)

    catch(Exception::Error)
    {
    throw error("@EdgeAXLabels:DemandAllocationBatchFailed");

    }
    catch(Exception::Deadlock)
    {
    retry;
    }
    catch(Exception::UpdateConflict)
    {
    if(appl.ttsLevel() == EgxConstants::Zero)
    {
    if(xSession::currentRetryCount()>=#RetryNum)
    {
    throw Exception::UpdateConflictNotRecovered;
    }
    else
    {
    retry;
    }
    }
    else
    {
    throw Exception::UpdateConflict;
    }
    }
    }

    ReplyDelete
    Replies
    1. Hi,

      EgxConstant is my constants string class which is use to show my labels. In your case you all need to do is to write 0 (Zero).

      Delete
    2. What does batchProcess.runOperations() do in Main & how & when does the customize code written under public void run () executes.

      Delete
    3. Hi,

      RunOperation() method executes the operation associated with the batch class also it executes Run() Method.

      Delete

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...