Skip to content

[Bug]: Error on new company with demo data: "‘Document record ID’ must contain a value in ‘E-document’" #8707

Open

Description

Describe the issue

German error text:
'Belegdatensatz-ID' muss in 'E-Beleg' einen Wert enthalten: 'Belegpostennr.=7'. Der Wert darf nicht null oder leer sein.
English translation:
‘Document record ID’ must contain a value in ‘E-document’: ‘Document item no. = 7’. The value must not be null or empty.

CallStack:
PostPurchaseInvoice (\BE-Fashion-Demo.app.source\Codeunit\5429\Contoso Inbound E-Document.dal:149) Generate (\BE-Fashion-Demo.app.source\Codeunit\5429\Contoso Inbound E-Document.dal:81) GenerateContosoInboundEDocuments (\BE-Fashion-Demo.app.source\Codeunit\11370\Create Demo EDocs DE.dal:56) OnRun (\BE-Fashion-Demo.app.source\Codeunit\11370\Create Demo EDocs DE.dal:26) EDocumentModule (\BE-Fashion-Demo.app.source\Codeunit\11374\E-Doc. Demodata DE.dal:29) LocalizationContosoDemoData (\BE-Fashion-Demo.app.source\Codeunit\11374\E-Doc. Demodata DE.dal:21) OnAfterGeneratingDemoData (\BE-Fashion-Demo.app.source\Codeunit\5193\Contoso Demo Tool.dal:297) GenerateDemoData (\BE-Fashion-Demo.app.source\Codeunit\5193\Contoso Demo Tool.dal:205) BuildDependencyAndGenerateDemoData (\BE-Fashion-Demo.app.source\Codeunit\5193\Contoso Demo Tool.dal:96) CreateNewCompanyDemoData (\BE-Fashion-Demo.app.source\Codeunit\5193\Contoso Demo Tool.dal:53) OnRun (\BE-Fashion-Demo.app.source\Codeunit\5382\Company Creation Contoso.dal:53) OnRun (\BE-Fashion-Demo.app.source\Codeunit\5279\Generate Contoso Demo Data.dal:27)

Expected behavior

the background job task for creating a new company with Contoso demo data should execute without any interruption and errors.

Steps to reproduce

  1. Use the German Localization
  2. Create a new Company on Companies (357, List)
  3. use Contoso Demo Data; Evaluation - Contoso Sample Data
  4. use all Contoso Demo Data Modules
  5. wait until the error occurs (see call stack)

Additional context

As far as I know, this happens every time, but not if i create an empty company and create the demo data afterwards over the contoso demo tool page.

Version: 27.3.44313.45104

Image

I will provide a fix for a bug

  • I will provide a fix for a bug

Activity

  1. github-actions commented on Mar 5, 2026

    @github-actions
    Contributor

    This issue has been approved for contribution ✅ Thanks for contributing.

  2. ventselartur commented on Mar 17, 2026

    @ventselartur
    Contributor

    Hello,

    Thanks for reporting this. I was not able to reproduce this on the latest:
    Version: DE Business Central 29.0 (Platform 29.0.47575.0 + Application 29.0.47676.0)

    I can create a new company from CRONUS DE following your repro steps.

    Image

    May i ask you to try on the latest?

  3. SchulzOli commented on Apr 27, 2026

    @SchulzOli
    Author

    i try to do it on 29.* but i can say that we have a bug on 28.0 as well.

  4. jeffreybulanadi commented on May 5, 2026

    @jeffreybulanadi
    Contributor

    Looking at this further, the error trace points to two separate problems that were introduced in v28.

    The primary issue: EDocDemodataDE was calling Create Demo EDocs DE at the Transactional demo data level. That codeunit called ContosoInboundEDocument.Generate(), which ran only the "Finish draft" import step. The CreateEDocSampleInvoices event subscriber was not bound at that point, so the purchase header update event did not fire. Without that event, the "Finish draft" step failed to set Document Record ID, and the subsequent TestField("Document Record ID") in PostPurchaseInvoice surfaced the validation error you saw. The call to Create Demo EDocs DE was removed from EDocDemodataDE as part of the v29 work, which is why the issue cannot be reproduced on v29.

    A secondary problem in the same codeunit: WorkDate() was modified before the Generate() calls and only restored at the very end of the procedure. If any call threw an error, WorkDate was left permanently modified for the rest of the session. This is the secondary fix in PR microsoft/ALAppExtensions#30006.

    Since the main crash is already resolved in v29, the PR addresses the remaining WorkDate state leak, which could still affect any environment where the obsolete codeunit is invoked directly.

  5. SchulzOli commented on May 5, 2026

    @SchulzOli
    Author

    thanks a lot for your answer and the provided informations.

  6. jeffreybulanadi commented on May 5, 2026

    @jeffreybulanadi
    Contributor

    Oliver Schulz (@SchulzOli) no worries, mate. let's wait for the reviewer to review my code.

  7. JesperSchulz commented on Jun 22, 2026

    @JesperSchulz
    Contributor

    Transferring this issue to BCApps. Repo migration to BCApps will complete next Monday. Jeffrey Bulanadi (@jeffreybulanadi), could you recreate the PR here when the repo migration is complete, please?

  8. JesperSchulz commented on Jun 22, 2026

    @JesperSchulz
    Contributor

    🤖 AI triage completed. Product group, please validate the triage report (Microsoft internal access only, use Ctrl+Click to open in new tab).


    Was this triage helpful? React with 👍 or 👎 on this comment to provide feedback.

  9. added
    Team: FinanceGitHub request for Finance area
    Ownership: ManualPreserve the manually selected team ownership
    and removed
    Team: IntegrationsGitHub request for Integrations area
    on Aug 26, 2026
  10. Aleyenda commented on Aug 26, 2026

    @Aleyenda

    ventselartur can you take a look at the latest comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ApprovedThe issue is approvedOwnership: ManualPreserve the manually selected team ownershipTeam: FinanceGitHub request for Finance area

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions