Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

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

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,786 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,786 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans