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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Batch job keeps retrieving old code

(0) ShareShare
ReportReport
Posted on by 1,087

Hi,

i've got a scheduled batch (RunBaseBatch Class) which calls a method in another Class (MyClass)

Class "MyClass" needed a fix in its code.

Now the scheduled batch seems to keep finding the old version of "MyClass".

Is there any workaround for this issue? (I mean, except rescheduling the RunBaseBatch job...)

Thank you in advance

regards

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    If it's about code, rescheduling wouldn't fix it. It's still the same code. Try recompiling your application.

    But maybe you mean that your batch tables contain the state (= member variables) of your class from the time when you scheduled it, which is as expected. In that case, delete the old batch and schedule a new one.

  • vv1984 Profile Picture
    1,087 on at

    Hi Martin,

    ScheduledClass calls ModifiedClass.

    I've recompiled ModifiedClass, but saw no changes in batch execution.

    It's not a matter of packed variables, but just a bunch of code lines replaced.

    Old version of ModifiedClass was something like:

    MyTable::find(CustId)

    New version is:

    select firstOnly MyTable where MyTable.CustId == CustId

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    First of all, what "changes in batch execution" do you expect? Both statements should do exactly the same thing, shouldn't they? Then the whole assumption about old code being executed doesn't look credible.

    It seems to me that you're looking for a problem where it isn't. Please tell us what problem did you try to fix by replacing find() with the select statement.

  • vv1984 Profile Picture
    1,087 on at

    The table MyTable has got that ::find() method no more. So i expected to fix it by using the select instead..

    But ScheduledClass keeps retrieving that old code from ModifiedClass.

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    Does it mean that you're getting an error about find() being missing?

    Please help me to help you. I don't have a crystal ball to see what's going in your system - you have to tell me.

  • vv1984 Profile Picture
    1,087 on at

    Yes, but a part from the error I get, the point is finding the reason why the batch job keeps retrieving the old code of my ModifiedClass, even if it has been already recompiled.

    I think I should have not recompiled ScheduledClass, since no edits has been made on its code. Only my ModifiedClass has been modified...

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    The problem may be in incorrect compilation (compiling just the modified object isn't enough in some cases), a cache, wrong detection from your side or who knows...

    I can't do more with the current amount of information.

  • Suggested answer
    Prabath Profile Picture
    665 on at

    Did you restarted the batch server and try?

  • Community Member Profile Picture
    on at

    Prabath's restart worked for me. I was experiencing the same issue. I have a minimalistic runbase class that runs nightly to create a sort of a snapshot/speed table. I updated the class and promoted it up. I noticed that the results from the nightly run weren't coming out as expected. During troubleshooting I noticed that if I ran the class from MorphX (not batch) that it produced the intended results, but if I ran the class from MorphX in batch it would not. RDP into batch server, stop service, start service, test results, and everything is good to go.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans