Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Deleting Finished Production Orders 2013

(0) ShareShare
ReportReport
Posted on by 1,042

Has there been a change to the software (2013) that now allows you to delete a finished Production Order, even if there are Item Ledger Entries associated with it?  It didn't let you do this previously but, now it seems that it does.  Is this a bug or "by design"?  

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Deleting Finished Production Orders 2013

    Can you delete more than once at a time?

  • Verified answer
    Mohana Yadav Profile Picture
    60,232 Super User 2025 Season 1 on at
    RE: Deleting Finished Production Orders 2013

    If you want to stop deleting if there are entries then you can use same old code.

  • DMV Profile Picture
    1,042 on at
    RE: Deleting Finished Production Orders 2013

    So, is there any way to restrict the users from doing this via permissions?  It's not it's own table like posted sales invoice so, can this be done in security or would we need to modify the code?  

  • Suggested answer
    DMV Profile Picture
    1,042 on at
    RE: Deleting Finished Production Orders 2013

    Does seem like it -- of course neither one of those seems like a good idea!  

    Thanks!

  • Suggested answer
    DMV Profile Picture
    1,042 on at
    RE: Deleting Finished Production Orders 2013

    Well, that does seem to be by design.  Thanks!

  • Suggested answer
    Miguel Llorca Gómez Profile Picture
    7,019 User Group Leader on at
    RE: Deleting Finished Production Orders 2013

    I think that the change is by design... in the same way that you can delete a posted sales invoice :-)

  • Suggested answer
    Mohana Yadav Profile Picture
    60,232 Super User 2025 Season 1 on at
    RE: Deleting Finished Production Orders 2013

    You are right.

    I don't know 100% whether it is a bug or bydesign.

    Earlier code was:

    IF Status IN [Status::Released,Status::Finished] THEN BEGIN

     ItemLedgEntry.SETCURRENTKEY("Prod. Order No.");

     ItemLedgEntry.SETRANGE("Prod. Order No.","No.");

     IF ItemLedgEntry.FIND('-') THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",ItemLedgEntry.TABLECAPTION);

     CapLedgEntry.SETCURRENTKEY("Prod. Order No.");

     CapLedgEntry.SETRANGE("Prod. Order No.","No.");

     IF CapLedgEntry.FIND('-') THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",CapLedgEntry.TABLECAPTION);

    END;

    IF Status = Status::Released THEN BEGIN

     PurchLine.SETCURRENTKEY(

       "Document Type",Type,"Prod. Order No.","Prod. Order Line No.","Routing No.","Operation No.");

     PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);

     PurchLine.SETRANGE(Type,PurchLine.Type::Item);

     PurchLine.SETRANGE("Prod. Order No.","No.");

     IF PurchLine.FIND('-') THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",PurchLine.TABLECAPTION);

    END;

    New Code is

    IF Status = Status::Released THEN BEGIN

     ItemLedgEntry.SETCURRENTKEY("Order Type","Order No.");

     ItemLedgEntry.SETRANGE("Order Type",ItemLedgEntry."Order Type"::Production);

     ItemLedgEntry.SETRANGE("Order No.","No.");

     IF ItemLedgEntry.FINDFIRST THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",ItemLedgEntry.TABLECAPTION);

     CapLedgEntry.SETCURRENTKEY("Order Type","Order No.");

     CapLedgEntry.SETRANGE("Order Type",CapLedgEntry."Order Type"::Production);

     CapLedgEntry.SETRANGE("Order No.","No.");

     IF CapLedgEntry.FINDFIRST THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",CapLedgEntry.TABLECAPTION);

    END;

    IF Status IN [Status::Released,Status::Finished] THEN BEGIN

     PurchLine.SETCURRENTKEY(

       "Document Type",Type,"Prod. Order No.","Prod. Order Line No.","Routing No.","Operation No.");

     PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);

     PurchLine.SETRANGE(Type,PurchLine.Type::Item);

     PurchLine.SETRANGE("Prod. Order No.","No.");

     IF PurchLine.FINDFIRST THEN

       ERROR(

         Text000,

         Status,TABLECAPTION,"No.",PurchLine.TABLECAPTION);

    END;

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans