Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Batch Job executes but does not show expected results

Posted on by 115

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...

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Batch Job executes but does not show expected results

    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?

  • 00030000036294D5 Profile Picture
    00030000036294D5 115 on at
    RE: Batch Job executes but does not show expected results

    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
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Batch Job executes but does not show expected results

    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
    00030000036294D5 115 on at
    RE: Batch Job executes but does not show expected results

    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 ?

  • 00030000036294D5 Profile Picture
    00030000036294D5 115 on at
    RE: Batch Job executes but does not show expected results

    Thanks Martin,

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Batch Job executes but does not show expected results

    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++.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans