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)

How to retrieve the deleted PO line in the confirmed PO?

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have created a PR with 4 lines. PR went through workflow and I created a PO from Release approved purchase requisitions screen by selecting all the lines at a time. Resulting in a PO with 4 lines. I realized I needed 4 different PO's after confirming the PO. I tried deleting the line in PO, expecting it would re appear in the release approved PR screen. Which did not happen.

Please let me know how to retrieve the deleted PO line in the confirmed PO

or

How can I create 4 different PO's for 4 line details of PR.

PS: I have confirmed the PO.

Thanks & Regards

Deepthi

*This post is locked for comments

I have the same question (0)
  • Wekey Profile Picture
    302 on at

    Hello Deepthi,

    Try the below code with little modifications as per your requirement. The following code is to get the deleted sales order line.

    static void LearningRestoreDeletedSO(Args _args)
    {
        SalesTableDelete    salesTableDelete;
        SalesLineDelete     salesLineDelete;
        SalesTable          salesTable;
        SalesLine           salesLine;
        ;
        SalesTableDelete = SalesTableDelete::find('SO-101462', true);
        ttsbegin;
        switch (salesTableDelete.Cancelled)
        {
            case Voided::Voided :
                salesTable  = conpeek(salesTableDelete.SalesTable, 1);
                salesTable.insert();
                while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
                {
                    salesLine = conpeek(salesLineDelete.SalesLine, 1);
                    salesLine.insert();
                }
                salesTableDelete.delete();
                break;
            case Voided::linesVoided :
                while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
                {
                    salesLine = conpeek(salesLineDelete.SalesLine, 1);
                    salesLine.insert();
                    salesLineDelete.delete();
                }
                salesTableDelete.delete();
                break;
       }
       ttscommit;
    }


    Try using purchTable and purchLine.

    Thanks.

  • Community Member Profile Picture
    on at

    Thanks for your reply Wekey.

    I do not have access to code in my system. is there any way I can re create the deleted PO line from User interface?

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Deepthi

    There is no way to do what you require through the screens alone. When you merged the lines, it became one PO. There is no undo in the front-end. For record keeping purposes, the system still has the lines and you can retrieve them with code (i.e. though a job).

    If you cannot do that for some reason, you'll have to redo the process and cancel the approved PO. Happy to hear if anyone has a better solution.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans