From 22b9c35aebc2473fa062eed129d22bd9012f62ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:09:28 +0000 Subject: [PATCH 01/11] Initial plan From 8c56da256d7de5b22f70a5e204e6f84966344417 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:14:30 +0000 Subject: [PATCH 02/11] Add Service Participants support for Company Information Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../src/Document/EDocumentSourceType.Enum.al | 1 + .../EDocCompanyInformation.PageExt.al | 48 +++++++++++++++++++ .../Helpers/EDocumentImportHelper.Codeunit.al | 27 +++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/Apps/W1/EDocument/App/src/Extensions/EDocCompanyInformation.PageExt.al diff --git a/src/Apps/W1/EDocument/App/src/Document/EDocumentSourceType.Enum.al b/src/Apps/W1/EDocument/App/src/Document/EDocumentSourceType.Enum.al index 2e6a4fbd37..7572ab4e06 100644 --- a/src/Apps/W1/EDocument/App/src/Document/EDocumentSourceType.Enum.al +++ b/src/Apps/W1/EDocument/App/src/Document/EDocumentSourceType.Enum.al @@ -12,4 +12,5 @@ enum 6123 "E-Document Source Type" value(0; Customer) { Caption = 'Customer'; } value(1; Vendor) { Caption = 'Vendor'; } value(2; Location) { Caption = 'Location'; } + value(3; Company) { Caption = 'Company'; } } diff --git a/src/Apps/W1/EDocument/App/src/Extensions/EDocCompanyInformation.PageExt.al b/src/Apps/W1/EDocument/App/src/Extensions/EDocCompanyInformation.PageExt.al new file mode 100644 index 0000000000..f2ffc8efb4 --- /dev/null +++ b/src/Apps/W1/EDocument/App/src/Extensions/EDocCompanyInformation.PageExt.al @@ -0,0 +1,48 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.eServices.EDocument.Extensions; + +using Microsoft.eServices.EDocument; +using Microsoft.eServices.EDocument.Service.Participant; +using Microsoft.Foundation.Company; + +/// +/// A page extension for the Company Information page to show the E-Document service participation. +/// +pageextension 6165 "E-Doc. Company Information" extends "Company Information" +{ + layout + { + addlast(General) + { + field("E-Document Service Participation Ids"; ParticipantIdCount) + { + ApplicationArea = All; + Caption = 'E-Document Service Participation'; + DrillDown = true; + Editable = false; + ToolTip = 'Specifies the company participation for the E-Document services.'; + + trigger OnDrillDown() + begin + ServiceParticipant.RunServiceParticipantPage(Enum::"E-Document Source Type"::Company, ''); + end; + } + } + } + + + var + ServiceParticipant: Codeunit "Service Participant"; + ParticipantIdCount: Integer; + + + trigger OnAfterGetCurrRecord() + begin + ParticipantIdCount := ServiceParticipant.GetParticipantIdCount(Enum::"E-Document Source Type"::Company, ''); + end; + +} diff --git a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al index 02abadb0af..7fc7c26cd6 100644 --- a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al @@ -266,6 +266,10 @@ codeunit 6109 "E-Document Import Helper" begin CompanyInformation.Get(); + // First, check if the Receiving Company Id matches a Company Service Participant + if MatchCompanyByServiceParticipant(EDocument) then + exit; + if (EDocument."Receiving Company GLN" = '') and (EDocument."Receiving Company VAT Reg. No." = '') then begin ValidateReceivingCompanyInfoByNameAndAddress(EDocument); exit; @@ -281,6 +285,29 @@ codeunit 6109 "E-Document Import Helper" EDocErrorHelper.LogErrorMessage(EDocument, CompanyInformation, CompanyInformation.FieldNo("VAT Registration No."), StrSubstNo(InvalidCompanyInfoVATRegNoErr, EDocument."Receiving Company VAT Reg. No.")); end; + /// + /// Use it to check if receiving company information matches a Company Service Participant. + /// + /// The E-Document record. + /// True if a matching Company Service Participant is found. + local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"): Boolean + var + ServiceParticipant: Record "Service Participant"; + begin + if EDocument."Receiving Company Id" = '' then + exit(false); + + ServiceParticipant.SetRange("Participant Type", ServiceParticipant."Participant Type"::Company); + ServiceParticipant.SetRange("Participant Identifier", EDocument."Receiving Company Id"); + ServiceParticipant.SetRange(Service, EDocument.GetEDocumentService().Code); + if ServiceParticipant.FindFirst() then + exit(true); + + // If no match found for the specific service, try to find any Company participant with this identifier + ServiceParticipant.SetRange(Service); + exit(ServiceParticipant.FindFirst()); + end; + /// /// Use it to check if receiving company name and address is in line with Company Information. /// From 0e3a699ffb0c0144451f718edb6b45ea41fcaf5e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:37:27 +0000 Subject: [PATCH 03/11] Add overload method with service argument, remove filter clearing Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../Helpers/EDocumentImportHelper.Codeunit.al | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al index 7fc7c26cd6..8b9935605b 100644 --- a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al @@ -291,6 +291,17 @@ codeunit 6109 "E-Document Import Helper" /// The E-Document record. /// True if a matching Company Service Participant is found. local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"): Boolean + begin + exit(MatchCompanyByServiceParticipant(EDocument, EDocument.GetEDocumentService().Code)); + end; + + /// + /// Use it to check if receiving company information matches a Company Service Participant for a specific service. + /// + /// The E-Document record. + /// The E-Document Service code to match against. + /// True if a matching Company Service Participant is found. + local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"; ServiceCode: Code[20]): Boolean var ServiceParticipant: Record "Service Participant"; begin @@ -299,12 +310,7 @@ codeunit 6109 "E-Document Import Helper" ServiceParticipant.SetRange("Participant Type", ServiceParticipant."Participant Type"::Company); ServiceParticipant.SetRange("Participant Identifier", EDocument."Receiving Company Id"); - ServiceParticipant.SetRange(Service, EDocument.GetEDocumentService().Code); - if ServiceParticipant.FindFirst() then - exit(true); - - // If no match found for the specific service, try to find any Company participant with this identifier - ServiceParticipant.SetRange(Service); + ServiceParticipant.SetRange(Service, ServiceCode); exit(ServiceParticipant.FindFirst()); end; From 3bb73afbb83c441ec890182e8ad413a4bdc29614 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:40:54 +0000 Subject: [PATCH 04/11] Pass ServiceCode from call site instead of using GetEDocumentService() Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../src/Helpers/EDocumentImportHelper.Codeunit.al | 15 +++------------ .../App/src/Processing/EDocImport.Codeunit.al | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al index 8b9935605b..2ae1b66249 100644 --- a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al @@ -260,14 +260,15 @@ codeunit 6109 "E-Document Import Helper" /// Use it to check if receiving company information is in line with Company Information. /// /// The E-Document record. - procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document") + /// The E-Document Service code to match against. + procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document"; ServiceCode: Code[20]) var CompanyInformation: Record "Company Information"; begin CompanyInformation.Get(); // First, check if the Receiving Company Id matches a Company Service Participant - if MatchCompanyByServiceParticipant(EDocument) then + if MatchCompanyByServiceParticipant(EDocument, ServiceCode) then exit; if (EDocument."Receiving Company GLN" = '') and (EDocument."Receiving Company VAT Reg. No." = '') then begin @@ -285,16 +286,6 @@ codeunit 6109 "E-Document Import Helper" EDocErrorHelper.LogErrorMessage(EDocument, CompanyInformation, CompanyInformation.FieldNo("VAT Registration No."), StrSubstNo(InvalidCompanyInfoVATRegNoErr, EDocument."Receiving Company VAT Reg. No.")); end; - /// - /// Use it to check if receiving company information matches a Company Service Participant. - /// - /// The E-Document record. - /// True if a matching Company Service Participant is found. - local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"): Boolean - begin - exit(MatchCompanyByServiceParticipant(EDocument, EDocument.GetEDocumentService().Code)); - end; - /// /// Use it to check if receiving company information matches a Company Service Participant for a specific service. /// diff --git a/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al b/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al index 7c9d49b734..c7d02d6763 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al @@ -278,7 +278,7 @@ codeunit 6140 "E-Doc. Import" EDocErrorHelper.LogWarningMessage(EDocument, EDocument2, EDocument2.FieldNo("Incoming E-Document No."), DocAlreadyExistsMsg); if EDocService."Validate Receiving Company" then - EDocImportHelper.ValidateReceivingCompanyInfo(EDocument); + EDocImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService.Code); end else EDocErrorHelper.LogSimpleErrorMessage(EDocument, GetLastErrorText()); From 9b0657fe32dc1b6b375b43c6df126790ae0176c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:49:18 +0000 Subject: [PATCH 05/11] Add backward-compatible overload for ValidateReceivingCompanyInfo, pass record not code Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../Helpers/EDocumentImportHelper.Codeunit.al | 28 +++++++++++++------ .../App/src/Processing/EDocImport.Codeunit.al | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al index 2ae1b66249..232e29d483 100644 --- a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al @@ -258,19 +258,29 @@ codeunit 6109 "E-Document Import Helper" /// /// Use it to check if receiving company information is in line with Company Information. + /// Also checks if the Receiving Company Id matches a Company Service Participant. /// /// The E-Document record. - /// The E-Document Service code to match against. - procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document"; ServiceCode: Code[20]) + /// The E-Document Service record to match against. + procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document"; EDocService: Record "E-Document Service") + begin + // First, check if the Receiving Company Id matches a Company Service Participant + if MatchCompanyByServiceParticipant(EDocument, EDocService) then + exit; + + ValidateReceivingCompanyInfo(EDocument); + end; + + /// + /// Use it to check if receiving company information is in line with Company Information. + /// + /// The E-Document record. + procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document") var CompanyInformation: Record "Company Information"; begin CompanyInformation.Get(); - // First, check if the Receiving Company Id matches a Company Service Participant - if MatchCompanyByServiceParticipant(EDocument, ServiceCode) then - exit; - if (EDocument."Receiving Company GLN" = '') and (EDocument."Receiving Company VAT Reg. No." = '') then begin ValidateReceivingCompanyInfoByNameAndAddress(EDocument); exit; @@ -290,9 +300,9 @@ codeunit 6109 "E-Document Import Helper" /// Use it to check if receiving company information matches a Company Service Participant for a specific service. /// /// The E-Document record. - /// The E-Document Service code to match against. + /// The E-Document Service record to match against. /// True if a matching Company Service Participant is found. - local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"; ServiceCode: Code[20]): Boolean + local procedure MatchCompanyByServiceParticipant(EDocument: Record "E-Document"; EDocService: Record "E-Document Service"): Boolean var ServiceParticipant: Record "Service Participant"; begin @@ -301,7 +311,7 @@ codeunit 6109 "E-Document Import Helper" ServiceParticipant.SetRange("Participant Type", ServiceParticipant."Participant Type"::Company); ServiceParticipant.SetRange("Participant Identifier", EDocument."Receiving Company Id"); - ServiceParticipant.SetRange(Service, ServiceCode); + ServiceParticipant.SetRange(Service, EDocService.Code); exit(ServiceParticipant.FindFirst()); end; diff --git a/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al b/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al index c7d02d6763..e9bfaa57e6 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al @@ -278,7 +278,7 @@ codeunit 6140 "E-Doc. Import" EDocErrorHelper.LogWarningMessage(EDocument, EDocument2, EDocument2.FieldNo("Incoming E-Document No."), DocAlreadyExistsMsg); if EDocService."Validate Receiving Company" then - EDocImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService.Code); + EDocImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService); end else EDocErrorHelper.LogSimpleErrorMessage(EDocument, GetLastErrorText()); From d7d4ce4a7facf03c194c6ed108309802098d1aa9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 16:34:35 +0000 Subject: [PATCH 06/11] Add tests for Company Service Participant matching in ValidateReceivingCompanyInfo Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../src/Receive/EDocHelperTest.Codeunit.al | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al index bf0a7b4f51..c7d2598d45 100644 --- a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al +++ b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al @@ -5,6 +5,8 @@ namespace Microsoft.eServices.EDocument.Test; using Microsoft.eServices.EDocument; +using Microsoft.eServices.EDocument.Service.Participant; +using Microsoft.Foundation.Company; using Microsoft.Purchases.Document; codeunit 139799 "E-Doc. Helper Test" @@ -14,6 +16,7 @@ codeunit 139799 "E-Doc. Helper Test" var Assert: Codeunit "Assert"; + LibraryEDoc: Codeunit "Library - E-Document"; trigger OnRun() begin @@ -48,4 +51,80 @@ codeunit 139799 "E-Doc. Helper Test" VendorNo := EDocumentImportHelper.FindVendor('', '', ''); Assert.IsTrue(VendorNo = '', 'Vendor No. should be empty'); end; + + [Test] + procedure ValidateReceivingCompanyInfoWithMatchingServiceParticipant() + var + EDocument: Record "E-Document"; + EDocService: Record "E-Document Service"; + ServiceParticipant: Record "Service Participant"; + EDocumentImportHelper: Codeunit "E-Document Import Helper"; + EDocErrorHelper: Codeunit "E-Document Error Helper"; + TestParticipantId: Text[200]; + begin + // [SCENARIO] Validation should succeed when a matching Company Service Participant exists + // [GIVEN] An E-Document with a Receiving Company Id + TestParticipantId := '0208:1234567890'; + EDocument.Init(); + EDocument."Entry No" := 0; + EDocument."Receiving Company Id" := TestParticipantId; + EDocument."Receiving Company GLN" := ''; + EDocument."Receiving Company VAT Reg. No." := ''; + EDocument.Insert(true); + + // [GIVEN] An E-Document Service + LibraryEDoc.CreateTestReceiveServiceForEDoc(EDocService, Enum::"Service Integration"::"Mock"); + + // [GIVEN] A matching Company Service Participant + ServiceParticipant.Init(); + ServiceParticipant.Service := EDocService.Code; + ServiceParticipant."Participant Type" := ServiceParticipant."Participant Type"::Company; + ServiceParticipant.Participant := ''; + ServiceParticipant."Participant Identifier" := TestParticipantId; + ServiceParticipant.Insert(true); + + // [WHEN] Validating receiving company info + EDocumentImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService); + + // [THEN] No errors should be logged (validation should exit early due to Service Participant match) + Assert.IsFalse(EDocErrorHelper.HasErrors(EDocument), 'No errors should be logged when Service Participant matches'); + + // Cleanup + ServiceParticipant.Delete(true); + EDocument.Delete(true); + end; + + [Test] + procedure ValidateReceivingCompanyInfoFallsBackToVATWhenNoServiceParticipant() + var + EDocument: Record "E-Document"; + EDocService: Record "E-Document Service"; + CompanyInformation: Record "Company Information"; + EDocumentImportHelper: Codeunit "E-Document Import Helper"; + EDocErrorHelper: Codeunit "E-Document Error Helper"; + begin + // [SCENARIO] Validation should fall back to VAT/GLN matching when no Service Participant exists + // [GIVEN] An E-Document with a Receiving Company Id that doesn't match any Service Participant + // [GIVEN] But has matching VAT Registration No. + CompanyInformation.Get(); + + EDocument.Init(); + EDocument."Entry No" := 0; + EDocument."Receiving Company Id" := '0208:NOMATCH'; + EDocument."Receiving Company VAT Reg. No." := CompanyInformation."VAT Registration No."; + EDocument."Receiving Company GLN" := ''; + EDocument.Insert(true); + + // [GIVEN] An E-Document Service with no matching Company Service Participant + LibraryEDoc.CreateTestReceiveServiceForEDoc(EDocService, Enum::"Service Integration"::"Mock"); + + // [WHEN] Validating receiving company info + EDocumentImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService); + + // [THEN] No errors should be logged (validation should succeed via VAT matching) + Assert.IsFalse(EDocErrorHelper.HasErrors(EDocument), 'No errors should be logged when VAT Registration No. matches'); + + // Cleanup + EDocument.Delete(true); + end; } \ No newline at end of file From 2774d2642e11825ddd22e1f00563dc1b2b065f46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 19:21:31 +0000 Subject: [PATCH 07/11] Fix AA0175: Use IsEmpty instead of FindFirst when only checking existence Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al index 232e29d483..e08ba1d533 100644 --- a/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al @@ -312,7 +312,7 @@ codeunit 6109 "E-Document Import Helper" ServiceParticipant.SetRange("Participant Type", ServiceParticipant."Participant Type"::Company); ServiceParticipant.SetRange("Participant Identifier", EDocument."Receiving Company Id"); ServiceParticipant.SetRange(Service, EDocService.Code); - exit(ServiceParticipant.FindFirst()); + exit(not ServiceParticipant.IsEmpty()); end; /// From d8bb261b011d4ad3428604d179e37a9cc3753e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hartvig=20Gr=C3=B8nbech?= Date: Thu, 29 Jan 2026 21:33:01 +0100 Subject: [PATCH 08/11] Attempt 1 --- AGENTS.md | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..7a3b297556 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,117 @@ +# Agent Instructions for BCApps Development + +This document provides instructions for AI agents working with the BCApps repository. + +## Mandatory Workflow + +When working on code changes in this repository, you **MUST** always follow this workflow: + +1. **Set up the environment** - Create a BC container if one doesn't exist +2. **Compile the code** - Verify that the AL code compiles without errors +3. **Build and publish the app** - Create the .app package and publish to the container +4. **Run tests** - Execute relevant tests to verify the changes work correctly + +**Never submit changes without completing all four steps.** + +## Prerequisites + +Before you can compile and test, ensure: +- Docker Desktop is installed and running Windows containers +- BcContainerHelper PowerShell module is installed + +To install BcContainerHelper: +```powershell +Install-Module BCContainerHelper -AllowPrerelease +``` + +## Step 1: Set Up Container + +Create a development container using the existing script: + +```powershell +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' +``` + +This will: +- Create a new BC container (if one doesn't already exist) +- Set up launch.json and settings.json in VSCode + +## Step 2: Compile and Publish Apps + +After making code changes, compile and publish: + +### Compile a Single App +```powershell +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '.\src\System Application\App' -RebuildApps +``` + +### Compile All Apps in a Project +```powershell +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '.\src\System Application\*' -RebuildApps +``` + +### Compile Using AL-Go Project +```powershell +.\build.ps1 -ALGoProject "System Application" +``` + +### Key Parameters +- `-ContainerName` - Name of the BC container to use +- `-ProjectPaths` - Paths to AL projects to compile (supports wildcards) +- `-RebuildApps` - Forces recompilation even if the app already exists +- `-SkipVsCodeSetup` - Skip VSCode configuration (useful for CI) + +## Step 3: Run Tests + +After apps are published, run tests using BcContainerHelper: + +```powershell +# Import required module +Import-Module BcContainerHelper + +# Get credentials (use same as container setup) +$credential = Get-Credential + +# Run all tests +Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testSuite "DEFAULT" + +# Run specific test codeunit +Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testCodeunit +``` + +### Test Types +- `UnitTest` - Unit tests that don't require external dependencies +- `IntegrationTest` - Tests that require integration with BC +- `Uncategorized` - Tests without a specific category + +### Test Isolation +- Tests with `DisableTestIsolation` use Test Runner codeunit `130451` +- Standard tests use Test Runner codeunit `130450` with codeunit isolation + +## Complete Workflow Example + +For every code change, execute this sequence: + +```powershell +# 1. Set up container (only needed once, skip if already exists) +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' + +# 2. Compile and publish your app changes +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '' -RebuildApps -SkipVsCodeSetup + +# 3. Compile and publish test app +.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '' -RebuildApps -SkipVsCodeSetup + +# 4. Run tests +$credential = Get-Credential +Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testSuite "DEFAULT" +``` + +## Important Rules + +1. **Always use the same container name** consistently across all commands +2. **Always use `-RebuildApps`** when you've made changes to ensure fresh compilation +3. **Check compilation output** for any errors before proceeding to tests +4. **If tests fail**, investigate and fix before considering the change complete +5. **Do not skip any step** - all four steps are mandatory for every change + From 7d5b8fa3f2736e520846768ac389b516c488153c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:02:35 +0000 Subject: [PATCH 09/11] Revert AGENTS.md commit as requested Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- AGENTS.md | 117 ------------------------------------------------------ 1 file changed, 117 deletions(-) delete mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 7a3b297556..0000000000 --- a/AGENTS.md +++ /dev/null @@ -1,117 +0,0 @@ -# Agent Instructions for BCApps Development - -This document provides instructions for AI agents working with the BCApps repository. - -## Mandatory Workflow - -When working on code changes in this repository, you **MUST** always follow this workflow: - -1. **Set up the environment** - Create a BC container if one doesn't exist -2. **Compile the code** - Verify that the AL code compiles without errors -3. **Build and publish the app** - Create the .app package and publish to the container -4. **Run tests** - Execute relevant tests to verify the changes work correctly - -**Never submit changes without completing all four steps.** - -## Prerequisites - -Before you can compile and test, ensure: -- Docker Desktop is installed and running Windows containers -- BcContainerHelper PowerShell module is installed - -To install BcContainerHelper: -```powershell -Install-Module BCContainerHelper -AllowPrerelease -``` - -## Step 1: Set Up Container - -Create a development container using the existing script: - -```powershell -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -``` - -This will: -- Create a new BC container (if one doesn't already exist) -- Set up launch.json and settings.json in VSCode - -## Step 2: Compile and Publish Apps - -After making code changes, compile and publish: - -### Compile a Single App -```powershell -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '.\src\System Application\App' -RebuildApps -``` - -### Compile All Apps in a Project -```powershell -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '.\src\System Application\*' -RebuildApps -``` - -### Compile Using AL-Go Project -```powershell -.\build.ps1 -ALGoProject "System Application" -``` - -### Key Parameters -- `-ContainerName` - Name of the BC container to use -- `-ProjectPaths` - Paths to AL projects to compile (supports wildcards) -- `-RebuildApps` - Forces recompilation even if the app already exists -- `-SkipVsCodeSetup` - Skip VSCode configuration (useful for CI) - -## Step 3: Run Tests - -After apps are published, run tests using BcContainerHelper: - -```powershell -# Import required module -Import-Module BcContainerHelper - -# Get credentials (use same as container setup) -$credential = Get-Credential - -# Run all tests -Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testSuite "DEFAULT" - -# Run specific test codeunit -Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testCodeunit -``` - -### Test Types -- `UnitTest` - Unit tests that don't require external dependencies -- `IntegrationTest` - Tests that require integration with BC -- `Uncategorized` - Tests without a specific category - -### Test Isolation -- Tests with `DisableTestIsolation` use Test Runner codeunit `130451` -- Standard tests use Test Runner codeunit `130450` with codeunit isolation - -## Complete Workflow Example - -For every code change, execute this sequence: - -```powershell -# 1. Set up container (only needed once, skip if already exists) -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' - -# 2. Compile and publish your app changes -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '' -RebuildApps -SkipVsCodeSetup - -# 3. Compile and publish test app -.\build\scripts\DevEnv\NewDevEnv.ps1 -ContainerName 'BCApps-Dev' -ProjectPaths '' -RebuildApps -SkipVsCodeSetup - -# 4. Run tests -$credential = Get-Credential -Run-TestsInBcContainer -containerName "BCApps-Dev" -credential $credential -testSuite "DEFAULT" -``` - -## Important Rules - -1. **Always use the same container name** consistently across all commands -2. **Always use `-RebuildApps`** when you've made changes to ensure fresh compilation -3. **Check compilation output** for any errors before proceeding to tests -4. **If tests fail**, investigate and fix before considering the change complete -5. **Do not skip any step** - all four steps are mandatory for every change - From 33dda72ea892e88e11866114b3e303c629cd4d50 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 07:50:31 +0000 Subject: [PATCH 10/11] Fix AL0118: Add missing using statement for Service Integration enum Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al index c7d2598d45..228aba9805 100644 --- a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al +++ b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al @@ -5,6 +5,7 @@ namespace Microsoft.eServices.EDocument.Test; using Microsoft.eServices.EDocument; +using Microsoft.eServices.EDocument.Integration; using Microsoft.eServices.EDocument.Service.Participant; using Microsoft.Foundation.Company; using Microsoft.Purchases.Document; From 611f6c6f8000d89f721ec91fd03b0a99dda6a284 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 08:07:54 +0000 Subject: [PATCH 11/11] Fix test permissions: Add TestPermissions = Disabled to EDocHelperTest Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al index 228aba9805..aa3d98f74c 100644 --- a/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al +++ b/src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al @@ -14,6 +14,7 @@ codeunit 139799 "E-Doc. Helper Test" { Subtype = Test; Access = Internal; + TestPermissions = Disabled; var Assert: Codeunit "Assert";