---
id: change/bcapps/13623
type: change
title: "#13623 [Dataverse] Fix duplicate sales line numbers with automatic recurring lines"
summary: Fixed an issue where creating a Business Central sales order from Dynamics 365 Sales could fail with duplicate line numbers when automatic recurring lines already existed. The importer now initializes the line counter from the last existing sales line instead of starting from zero.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit crm sales order to sales order
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-11-07T01:03:50.235Z"
  flags: []
generated:
  at: "2026-11-09T00:15:52.409Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 9735d327706b4f912d89f43d6949ff3902362156
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/13623
    title: "microsoft/BCApps#13623: [Dataverse] Fix duplicate sales line numbers with automatic recurring lines"
    date: "2026-11-06"
    commit: 9735d327706b4f912d89f43d6949ff3902362156
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/5343
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/sales-how-work-standard-lines
      title: Standard recurring sales lines
      label: possibly related
      why: Documents standard recurring sales lines feature that automatic recurring lines implement.
      by: model
number: 13623
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/13623
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-06T12:14:49Z"
author: gggdttt
author_type: User
community_contribution: false
labels:
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 2
  additions: 175
  deletions: 0
  al: 1
apps:
  - Base Application
objects_touched:
  - key: codeunit/5343
    page: codeunit/5343
    type: codeunit
    id: 5343
    name: CRM Sales Order to Sales Order
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 654747
systems:
  - integration
quote: null
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #13623 [Dataverse] Fix duplicate sales line numbers with automatic recurring lines

> Fixed an issue where creating a Business Central sales order from Dynamics 365 Sales could fail with duplicate line numbers when automatic recurring lines already existed. The importer now initializes the line counter from the last existing sales line instead of starting from zero.

[Pull request](https://github.com/microsoft/BCApps/pull/13623) · merged into `main` (BC30) on 2026-11-06 by gggdttt · 2 files (+175 -0), 1 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- LastSalesLineNo counter is now initialized from the last existing sales line for the document
- Counter is reset for every order to prevent number conflicts
- In-memory allocation logic preserved to prevent extended description lines from reusing main line numbers
- Existing recurring lines are preserved during import
- Regression tests added covering single recurring line, multiple recurring lines with products and descriptions, and successive orders
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 5343 "CRM Sales Order to Sales Order"](../../objects/codeunit/5343.md), Base Application: modified

## Context

- Work items: AB#654747
- Labels: Team: Integrations
- Systems: integration

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Standard recurring sales lines](https://learn.microsoft.com/dynamics365/business-central/sales-how-work-standard-lines) — possibly related: Documents standard recurring sales lines feature that automatic recurring lines implement. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
