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 :
Microsoft Dynamics AX (Archived)

Insert Record to InventSum and InventTrans

(0) ShareShare
ReportReport
Posted on by

Hi All,

Anyone can give me some guide or tips on this scenario.

I delete the record in InventTrans and InventSum.

Now I am trying to create a Job to insert it back to InventTrans and InventSum as well using the record in SalesLine.

 

Anyone can help me.

Thanks in Advance

Ariston

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Joris dG Profile Picture
    17,775 on at

    Manipulating records in inventtrans and inventsum directly is a HUGE violation of AX data. Never, ever, ever, ever, ever, ever, ever update, insert or delete records in these tables yourself. There is ALWAYS a way to use the front-end transaction (salesline, journaltrans, etc) to achieve what you wish to do.

    My advice: restore your database and rethink what you are trying to achieve.

  • Ariston J. Profile Picture
    on at

    Thanks Joris,

    But my Consultant want to do that I think he want to do something on that.

    These are the scenario.

    In SQL my Consultant delete the record in INVENTTRANS and INVENTSUM.

    Then he want to put it back using Job in AX.

    I have a valid SALESLINE record with InventTransID. No need to create new InventTransID when I push it back to INVENTTRANS and INVENTSUM also just push all the record to that table.

    This is my sample job code do you think this is wrong? do I need to put some classes or methods?

    static void Job24(Args _args)
    {
        SalesLine   salesLine;
        InventTrans inventTrans;
        ;
        while select salesLine where
        salesLine.SalesId == 'SO1208/0001'
        {
            select forupdate inventTrans;
                inventTrans.InventTransId   = salesLine.InventTransId;
                inventTrans.ItemId          = salesLine.ItemId;
                inventTrans.Qty             = salesLine.SalesQty;
            inventTrans.insert();
        }
    }

  • Suggested answer
    dolee Profile Picture
    11,279 on at

    Hi Ariston,

    If your sales Lines has not been received/posted with anything, then delete that sales lines and insert them again.

    Otherwise.....I would +1 on Joris suggestion of restore a backup and rethink.

    For your reference, AX uses a bunch of classes to manipulate the inventTrans due to complex logic and connections to different module and business processes. Which is the reason why manipulating them directly has been a No-no from day 1.

  • Community Member Profile Picture
    on at

    [View:http://cdn.memegenerator.net/instances/400x/34903227.jpg]  

    :)

  • Verified answer
    Joris dG Profile Picture
    17,775 on at

    Andi, you crack me up :-)

    I've seen the same picture with the phrase "one does not simply implement vanilla AX"...

  • Ariston J. Profile Picture
    on at

    haha

  • dolee Profile Picture
    11,279 on at

    Lol

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans