Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to reverse these hundreds of posted inventory movement journals by X++ code

(0) ShareShare
ReportReport
Posted on by 2,674

I have posted some hundreds of inventory movement journals and suddenly we realized that most of them are wrong, how to reverse these hundreds of posted inventory movement journals by X++ code, any idea/job?

Regards,

-Afsar

*This post is locked for comments

  • Brandon Wiese Profile Picture
    Brandon Wiese 17,788 on at
    Re: How to reverse these hundreds of posted inventory movement journals by X++ code

    If you wanted to automate the reversing process in code, you could use InventJournalCopy something like this (look at InventJournalCopy::main(..) for usage hints) --

    InventJournalCopy   copy = InventJournalCopy::construct();

    copy.getLast();

    copy.parmJournalIdFrom( journalNumHere );

    copy.run();

    This is not tested code.  Use at your own risk.

  • Suggested answer
    Brandon Wiese Profile Picture
    Brandon Wiese 17,788 on at
    Re: How to reverse these hundreds of posted inventory movement journals by X++ code

    On the journal form there is a button called Functions -> Copy that creates and populates a new journal from an existing one.  The code behind this is Classes\InventJournalCopy.  In the run() method you could temporarily modify the copyInventJournalTrans(..) internal function to reverse the sign of inventJournalTransTo.qty before the record is inserted.  Or, if this is something you expect to do regularly, you could add a parameter to the dialog like "Reverse quantity" and code accordingly.

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans