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)

Cannot Pick Items after restoring sales order

(0) ShareShare
ReportReport
Posted on by 495

Help guys,

one of my user deleted a sales order and i managed to restore the order using the following code  

Sales order restoration:
 
static void restoreDeletedSO(Args _args)
{
    SalesTableDelete    salesTableDelete;
    SalesLineDelete     salesLineDelete;
    SalesTable          salesTable;
    SalesLine           salesLine;
    ;
    SalesTableDelete = SalesTableDelete::find(‘00450_036’, 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;
}

After my order was restored i realize that we cannot do any picking list or picking list registration. both buttons are grayed out.

6014.capture1.PNG

However if i change the quantity on the line it becomes active. unfortunately i cannot change the quantity because that the quantity the customer wants.

Can someone please help me resolve this?

*This post is locked for comments

I have the same question (0)
  • Guy Terry Profile Picture
    28,970 Moderator on at

    Wouldn't it have been easier to get the user to recreate the order manually?

    Do the lines on the resurrected sales order have Inventory transactions?

  • Lionel07 Profile Picture
    495 on at

    Hola Guy, No inventory transaction exit on the lines and i think that what causing the problem.

  • Verified answer
    Sukrut Parab Profile Picture
    71,735 Moderator on at

     When you change the quantity most probably transactions are being generated and that makes those button enable for you.  You can cancel that line after changing quantity  and renter  line with same item and quantity  and try to process it

  • Lionel07 Profile Picture
    495 on at

    yes this works and thanks for your help. I was thinking maybe there was something i needed to do differently or to even modify the  code. I really did not want to have to redo the lines on the order. thanks again.

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