---
id: post/yzhums-com/69356
type: post
title: "Dynamics 365 Business Central: How to automatically archive sales orders via AL (For example, Archive on Order Release)"
summary: This post explains how to automatically archive sales orders in Business Central when they are released using AL code. It covers the standard archiving capabilities for sales documents and demonstrates how to extend automatic archiving beyond the built-in triggers by subscribing to the release event and calling the ArchiveManagement codeunit.
tier: community
language: en
tags:
  - archiving
  - sales orders
  - automation
  - al development
  - event subscribers
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:41:15.715Z"
  flags: []
generated:
  at: "2026-10-26T05:51:10.938Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 3a981ca76162dbc2233e610b21c99fd02ecc41abb37f5d1993d1770bb40cca3a
evidence:
  - kind: blog
    url: https://yzhums.com/69356/
    title: "Dynamics 365 Business Central: How to automatically archive sales orders via AL (For example, Archive on Order Release)"
    date: "2025-12-04"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/69356/
    title: "Dynamics 365 Business Central: How to automatically archive sales orders via AL (For example, Archive on Order Release)"
    date: "2025-12-04"
    commit: null
    t: null
    quote: In Business Central, you can archive sales, purchase, and service orders, quotes, return orders, and blanket orders.
  - kind: blog
    url: https://yzhums.com/69356/
    title: "Dynamics 365 Business Central: How to automatically archive sales orders via AL (For example, Archive on Order Release)"
    date: "2025-12-04"
    commit: null
    t: null
    quote: We can use the following standard method. codeunit 5063 ArchiveManagement -> StoreSalesDocument
links:
  learn: []
  objects:
    - object/codeunit/5063
    - object/codeunit/414
    - object/page/459
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
post_id: "69356"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/69356/
published_at: "2025-12-04T01:56:19.000Z"
author: Yun Zhu
full_text: false
words: 375
quotes:
  - text: In Business Central, you can archive sales, purchase, and service orders, quotes, return orders, and blanket orders.
    why_it_matters: Establishes the scope of archivable document types, helping users understand what can be archived in the system
  - text: We can use the following standard method. codeunit 5063 ArchiveManagement -> StoreSalesDocument
    why_it_matters: Provides the practical solution approach using existing platform APIs without requiring full custom implementation
code_objects_mentioned:
  - codeunit ArchiveManagement
  - codeunit Release Sales Document
  - codeunit ArchiveEventHandler
  - page Archived Sales Orders
  - page Sales & Receivables Setup
systems:
  - sales
  - development
versions_mentioned: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2025/12/Snipaste_2025-12-04_10-54-04.png
  image_alt: null
  image_w: null
  image_h: null
  site_name: Dynamics 365 Lab
  favicon: https://yzhums.com/wp-content/uploads/2020/08/cropped-logo-3-32x32.png
  probed_at: "2026-10-26T06:11:15.014Z"
---

# Dynamics 365 Business Central: How to automatically archive sales orders via AL (For example, Archive on Order Release)

[Read the post](https://yzhums.com/69356/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2025-12-04 · 375 words · tier community · reviewed (checked by Opus)

> This post explains how to automatically archive sales orders in Business Central when they are released using AL code. It covers the standard archiving capabilities for sales documents and demonstrates how to extend automatic archiving beyond the built-in triggers by subscribing to the release event and calling the ArchiveManagement codeunit.

## Key points

- Business Central allows archiving of sales, purchase, service orders, quotes, return orders, blanket orders, and projects multiple times with each archive creating a new version
- Standard automatic archiving triggers exist for status changes, document deletion, printing/sending, quote-to-order conversion, and posting
- Adding custom automatic archiving triggers like order release requires AL code using event subscribers to extend beyond built-in functionality
- The ArchiveManagement codeunit's StoreSalesDocument method enables programmatic archiving without showing confirmation dialogs
- Archived sales documents can be restored to overwrite the original if it still exists and is unposted

## Quotes

- "In Business Central, you can archive sales, purchase, and service orders, quotes, return orders, and blanket orders." (Establishes the scope of archivable document types, helping users understand what can be archived in the system)
- "We can use the following standard method. codeunit 5063 ArchiveManagement -> StoreSalesDocument" (Provides the practical solution approach using existing platform APIs without requiring full custom implementation)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- [codeunit 5063 "ArchiveManagement"](../../objects/codeunit/5063.md)
- [codeunit 414 "Release Sales Document"](../../objects/codeunit/414.md)
- codeunit "ArchiveEventHandler"
- page "Archived Sales Orders"
- [page 459 "Sales & Receivables Setup"](../../objects/page/459.md)

Not found in BC28-30: codeunit "ArchiveEventHandler", page "Archived Sales Orders".

## Context

- Features: automatic archiving, document archiving, sales order archiving, event subscribers, archive restoration

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
