web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Processing an AOT Job in batch

(0) ShareShare
ReportReport
Posted on by

Hi all

I have an AOT job that updates records in ProjForecast. Can I process this job in batch? 

*This post is locked for comments

I have the same question (1)
  • Suggested answer
    Rudi Hansen Profile Picture
    4,075 on at

    Yes

  • Community Member Profile Picture
    on at

    I couldn't find out how to do it. Will you please describe how to do it?

  • Suggested answer
    Rudi Hansen Profile Picture
    4,075 on at

    Sure, but i need a little more information from you.

    What excactly are you trying to run, it is an AX Job or a Class?

    If its a job then the quick answer is move your code to a class, you can run a job in batch but only by creating a class that runs the job, and that a little cumbersome.

    It its a class, then make it extend SysOperation Framework, then you can run the class in batch.

  • Community Member Profile Picture
    on at

    Hi Rudi

    I have both class and an AOT Job. I dont know which one will be easiest to develop.

    My class:

    class NCUpdate_ProjForecast 
    {
    }

    [SysEntryPointAttribute(false)]
    public void processRecords()
    {
        ProjForecastCost projForeCastCost;
    
         //Determines the runtime
        if (xSession::isCLRSession())
        {
            info('Running in a CLR session.');
        }
        else
        {
            info('Running in an interpreter session.');
    
            //Determines the tier
            if (isRunningOnServer())
            {
                info('Running on the AOS.');
            }
            else
            {
                info('Running on the Client.');
            }
        }
    
        while select forUpdate projForeCastCost
    
        {
            ttsBegin;
            //Do something
    
            projForeCastCost.update();
            ttsCommit;
        }
    }


    Then I created an Action MenuItem:

    2016_2D00_05_2D00_11_5F00_16h25_5F00_00.png

    when I run it, the batchjob gets created, but I get the following error. 

    2016_2D00_05_2D00_11_5F00_16h25_5F00_00.png

  • Rudi Hansen Profile Picture
    4,075 on at

    You need use the class, and make it run in the SysOperation Framework.

    I will try to have a look at it during the day today.

  • srinivas pamidi Profile Picture
    1,737 on at

    Hai Mahyar,

    Look at the Class Tutorial_RunbaseBatch It is the Standard Example for Batch Processing.

    See this Class, Duplicate this Class Make some Changes in this Class according to your Scenario.

    It is Working for me.

  • Suggested answer
    PA-22040759-0 Profile Picture
    6,194 on at

    Mahyar,

    It seems to me that you are missing to do a CIL compilation. I can reproduce your error before doing CIL, but not after.

    When the job is executed in batch, it is the CIL version of the code that gets executed.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Mahyer,

                      Extend your class to "RunBaseBatch" and after adding the code to "Run" Method of the class, compile your code and then after compilation do an "Incremental CIL".

    Best Regards

    Shah

  • Suggested answer
    Community Member Profile Picture
    on at

    Also add your logic in the "Run" method of the Extended Class.

    Bests

    Shah

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans