Delete Sales Orders

kwajahathydrokwajahathydro Member Posts: 88
Hi,

We are using Navision 2009 SP1 SG Version. In our sales orders, there is a small customization. Navision in standard terms allows to create Shipment Documents and generates Invoice only when we post the order, but here we have a small function called, Generate Shipment and Invoice Number even before the sales order is getting posted in Navision.

Now, some times the users are deleting orders from system which are creating gaps in our number series for posted sales shipments and posted sales invoices, the reason for this, once i have a sales order, i click functions and generate shipment number and invoice number, then i want to delete sales order by pressing F4, nav says deleting this would cause a gap in number series and etc

I want to block this deletion, means I want to tell sales orders that once there is any Shipment number and invoice number already generated then do not allow the user to delete the order with a check mar in user setup, so how to do it or is there any other simple way of doing it

Regards
KH

Comments

  • navuser1navuser1 Member Posts: 1,329
    Put you code on Ondelete trigger of table.

    Example :- Item table , Ondelete tigger

    If there is any ILE you can not delete Item.

    Hope this will help.
    Now or Never
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi,

    Can you write the code in detail for me as I am a functional guy who doesnt know much about programming terms. I am just trying to help my client with this.

    Regards
    KH
  • SavatageSavatage Member Posts: 7,142
    Assuming your customization is filling fields "Posting No." & "Shipping No." then all you have to do is to check if these fields have values and if so throw an error.

    On the Sales Header Table add it to OnDelete trigger.

    something like

    if ("Posting No." <>'') and ("Shipping No." <>'') then
    Error('You can not delete order %1. Posting & Shipping Numbers Exist!',"No.");
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Hi,

    Can you write the code in detail for me as I am a functional guy who doesnt know much about programming terms. I am just trying to help my client with this.

    Regards
    KH

    By the way, your client can't do this without a developer license.
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi,

    I have developer License and I can change the license only for that session and then can follow your code but only if you tell me on which table and which area to write the code

    Regards
    KH
  • swati_indiaswati_india Member Posts: 10
    Hi,

    Can you write the code in detail for me as I am a functional guy who doesnt know much about programming terms. I am just trying to help my client with this.

    Regards
    KH

    In that case it is best to call a tech guy instead of you messing around with forum support. Since the forum members don't have access to your database, all of them will be make guess.
    Remember "Little knowledge is more dangerous".
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi,

    I am not messing up with anything! I have always tested in my local first b4 I apply change to live!

    Regards
    KH
  • SavatageSavatage Member Posts: 7,142
    Savatage wrote:
    On the Sales Header Table add it to ondelete trigger
    I thought it did mention where
Sign In or Register to comment.