any event or trigger to use after OnDelete()

vh8000vh8000 Member Posts: 23
edited 2015-06-11 in NAV Three Tier
Hi All

I have a page designed look like below:-

Piece | Weight
1 | 2.12
2 | 6.21
3 | 7.22

If user delete the second line (2 | 6.21), I would like to write my own code to auto. re-arrange the data like:-

Piece | Weight
1 | 2.12
2 | 7.22

I cannot use OnDelete() event because it triggered before the deletion.

Is this any Event / Trigger (something like OnAfterDelete()) I can use to do that?

Thanks

Comments

  • Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Even though the OnDelete trigger is executed before the record is actually deleted I think you should use that trigger.

    In the OnDelete trigger you know what record is about to be deleted ( that is: the record that is the current record in the OnDelete trigger), so you can make the process you want to execute (in this case the renumbering) skip that record.
    Jan Veenendaal
  • pdjpdj Member Posts: 643
    I have had the same problem several times, and found a workaround:
    OnDelete()
    <some normal code>
    DELETE(FALSE);
    <the code requiring the record to be deleted>
    INSERT(FALSE);
    
    I looks awful, but it does the job...
    (It can also be used in the OnInsert() and OnModify() triggers with a few adjustments)
    Regards
    Peter
  • pdjpdj Member Posts: 643
    Don't you understand my solution, or doesn't it solve your case?
    Regards
    Peter
  • vh8000vh8000 Member Posts: 23
    pdj wrote:
    Don't you understand my solution, or doesn't it solve your case?

    Sorry for my late reply.

    All methods suggested in this post created an unexpected result.
    It might be the key I used in this table ("Document No.", "Line No.")

    Anyways, thanks a lot for all helps.

    I end up created an ActionItem that allow the user to "Rearrange the order".
Sign In or Register to comment.