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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Batch Job executes but does not show expected results

(0) ShareShare
ReportReport
Posted on by 117

Hi all, 

       I am working with a batch job. When I run the batch job by creating a job and making object of the class, the outcome is as expected. 

When I run the Main method of the batch class and run it, The batch job executes, but does not give me expected results. 

How can I check what is wrong with it? Please help...

I have the same question (0)
  • Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at

    You can use the debugger to find out what's going on in your code. Refer to Debugging in Microsoft Dynamics AX 2012 for more information.

    Also, don't forget that batch processes work (by default) in CIL, therefore you should generate CIL after compiling X++.

  • 00030000036294D5 Profile Picture
    117 on at

    Thanks Martin,

    I have already run both of these one after the other but no use ?

  • 00030000036294D5 Profile Picture
    117 on at

    Martin,

               I have just compiled my entire class, then generated incremental CIL and afterwards run batch job through Main method of the class.

    The batch job entered into queue. Now, it is showing status as Executing for the last 10 minutes. The same happened yesterday after I generated full incremental CIL and then ran the batch job. Where it gets stuck ?

  • Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at

    I'm sorry, but I can't tell you where it got stuck, because I have absolutely no information about your and I can't debug it. The debugger is your hands.

  • 00030000036294D5 Profile Picture
    117 on at

    Martin.

              I have noticed a new thing. I had recently made few code changes in the batch job class. When I remove my changes, the batch job executes perfectly alright.

    But this is again a bit confusing in a way that when I run the batch job class by creating a job and making an object of the class, the class runs perfectly alright and gives desired results.

    However, when I try to run it through batch job i.e. by running it through the Main method of the batch job class, The batch job gets stuck in executing state and never ends.

    What is wrong here and how do I correct it. Why the class is running through Job and why it is not running through batch job ? Where is the problem ?

  • Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at

    I'm sorry, but just keep asking me what's wrong doesn't make a good sense. You've never showed us your code, nor you at least told us what it's supposed to do, so it impoossible for me to identify the bug.
    My recommendation is still the same - use the debugger to find out where you code fails. Why haven't you done it yet?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans