Options

RecreateSalesLines -- Why?

njhansennjhansen Member Posts: 37
Can anyone provide a comprehensive list of the reasons that NAV deletes the sales lines and recreates them after certain user actions? For instance it recreates them after changing bill-to customer no.

I know some of the effects, but am not sure I know them all:
1) Update dimension data and other data copied from header to lines
2) Prevent changes if some lines have already posted


The problem:
We've received some add-in code from a third party that works fine until we do something that causes SalesHeader.RecreateSalesLines to run. I've worked through repairing most of the negative side effects, but am hung up at a place at which the most straightforward resolution require a commit (codeunit call that modifies its own copy of the SalesLine record). I don't want to commit in the middle of recreating sales lines, since later code can still error.

So, I was considering trying to go another route to get the same effects that RecreateSalesLine is getting, but without calling it. But to do that, I need to know what all the effects should be.

In addition, I'm just curious as to why RecreateSalesLines exists. It seems that if the goal is purely to refresh data from the header that discarding then recreating all the lines is overly complicated. If some other goal is in mind, it seems strange that most of the values being re-created are not validated.

Answers

  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    If you change the "Bill-to Customer No.", the other customer could have a different language setting, therefore the Item Description needs to be updated. The other customer could have a different discount group, therefore the price needs to be updated. etc.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    njhansennjhansen Member Posts: 37
    Thanks Luc. Multi-lingual and multi-currency issues are "obvious" ones I should have thought of; our current environment doesn't require either, but we might in the future.

    Lacking any other responses, I'll consider this question answered for now.
Sign In or Register to comment.