web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Sales Header table vs Sales Header Archive table

(0) ShareShare
ReportReport
Posted on by

I wrote an adhoc SQL statement joining the two tables on "No_" and noticed we have a little bit of overlap where the same sales document is present in both tables.  What are the conditions for a sales document to be archived? How can I see sales documents in both tables?

Also, what statuses are available to a sales document? Is this customizable? 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rabin Profile Picture
    2,976 on at

    Hi,

    when ever you call function to Archive any Sales Order it keeps the current document with a Version. The next time you call archive again, it will keep the same document with another version in the Sales Order Archive document.

    So, in your case, there will be at least one key that will make each record in archive document unique and its VERSION.

    The Relation will be One to Many, since you can archive as many times you want.

  • Community Member Profile Picture
    on at

    Hi.

    So, archiving is not necessarily to do with the processing of an order?  I don't full understand the reason for archiving.  Is it just to capture/version the document at certain points in time as things change on the document?  It sounds like you can continue to archive as much as you want during the life of a sales document.

  • Suggested answer
    Alex A Profile Picture
    2,922 on at

    The Sales Header Archive table can have many versions of the same Sales Order. The archiving function can occur when you manually archive the Sales Order by pushing the Archive button in the ribbon, or it can archive when you change Status of the Sales Order, or at other intervals. It simply takes a snapshot in time of your Sales Order. The most common need to manually archive a Sales Order would be if you needed to delete it - usually first you would archive it before deleting it just as a practice.

    In a production setting you probably wouldn't join these two tables together, but you might join in the Sales Header Archive table in combination with other tables depending on what you're trying to achieve. If you ever do need to do this, you would usually have to add some clever SQL to join only the latest archived version of the Sales Order with whatever other table you are needing to join it with. If you don't specify that you want the latest version of the archive table in your query, you will end up with multiple rows in your result. 

  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at

    I agree with other members here that normally you would not need to do this, as the archive represents just a momentary snapshot of certain sales order. You can have many copies of those if you need. Normally you would want to archive it before deleting just to keep copy of that. Also, you can setup automatic archiving ( msdn.microsoft.com/.../hh935230(v=nav.90).aspx ) if needed.

    What is the main reason you would need to join this two tables? What information you are trying to get from Sales Header Archive?

    As per your second question - you can read about Sales Header statuses here: https://msdn.microsoft.com/en-us/library/hh895848(v=nav.90).aspx . There are 4 default statuses, but you can customize your solution and add more if needed, or add additional field with more other statuses.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans