Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Add Service Participants to Company Information

This PR enables Belgian companies using Peppol to configure Service Participants on Company Information, so that incoming eDocuments using Peppol Scheme 0208 (Enterprise Number) are correctly matched and received.

Changes Made

  • 1. Extend E-Document Source Type Enum

    • Added "Company" value (value 3) to enum 6123 "E-Document Source Type"
  • 2. Add Page Extension for Company Information

    • Created page extension 6165 for Company Information page
    • Added "E-Document Service Participation" field similar to Customer/Vendor extensions
    • Field shows count of Service Participants and drills down to the list
    • Uses empty string ('') as Participant code since Company Information is a singleton
  • 3. Update Matching Logic (Backward Compatible)

    • Added new overload ValidateReceivingCompanyInfo(EDocument, EDocService) that checks Service Participants first
    • Preserved original ValidateReceivingCompanyInfo(EDocument) signature for backward compatibility
    • New overload calls the original method after Service Participant check
    • MatchCompanyByServiceParticipant takes EDocService record parameter
    • Updated call site in EDocImport to pass EDocService record
    • Priority order: Service Participant → VAT Reg No. → GLN → Name/Address
  • 4. Add Tests

    • Added ValidateReceivingCompanyInfoWithMatchingServiceParticipant test: Verifies validation succeeds when a matching Company Service Participant exists
    • Added ValidateReceivingCompanyInfoFallsBackToVATWhenNoServiceParticipant test: Verifies fallback to VAT/GLN matching when no Service Participant matches
  • 5. Fix Build Warnings/Errors

    • Fixed AA0175: Use IsEmpty() instead of FindFirst() when only checking record existence
    • Fixed AL0118: Added missing using Microsoft.eServices.EDocument.Integration; for Service Integration enum

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copilot AI changed the title [WIP] Add service participants configuration for company information Add Service Participants support for Company Information Jan 29, 2026
Copilot AI requested a review from Groenbech96 January 29, 2026 15:19
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 29, 2026
@github-actions
Copy link

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'

@Groenbech96
Copy link
Contributor

@copilot Create a overload method that takes the service as argument and provides it on the table. Dont remove the filter after as well.

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot Create a overload method that takes the service as argument and provides it on the table. Dont remove the filter after as well.

Done in 0e3a699. Created an overload MatchCompanyByServiceParticipant(EDocument, ServiceCode) that takes the service code as argument and removed the filter clearing logic.

@Groenbech96
Copy link
Contributor

@copilot dont use EDocument.GetEDocumentService().Code)).

At the call site of check receiving company info, there is a known service. Use that one.

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot dont use EDocument.GetEDocumentService().Code)).

At the call site of check receiving company info, there is a known service. Use that one.

Done in 3bb73af. Updated ValidateReceivingCompanyInfo to accept ServiceCode parameter and updated the call site in EDocImport.Codeunit.al to pass EDocService.Code directly. Removed the overload that was using GetEDocumentService().Code.


if EDocService."Validate Receiving Company" then
EDocImportHelper.ValidateReceivingCompanyInfo(EDocument);
EDocImportHelper.ValidateReceivingCompanyInfo(EDocument, EDocService.Code);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Pass the record, not a code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9b0657f. Now passes the EDocService record instead of EDocService.Code.

/// <param name="EDocument">The E-Document record.</param>
procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document")
/// <param name="ServiceCode">The E-Document Service code to match against.</param>
procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document"; ServiceCode: Code[20])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This is breaking. Please add an overload. Then call this original and do the new stuff before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9b0657f. Added backward-compatible overload ValidateReceivingCompanyInfo(EDocument, EDocService) that first checks Service Participants, then calls the original ValidateReceivingCompanyInfo(EDocument) method.

…ss record not code

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
@Groenbech96 Groenbech96 marked this pull request as ready for review January 29, 2026 16:31
@Groenbech96 Groenbech96 requested a review from a team as a code owner January 29, 2026 16:31
@Groenbech96
Copy link
Contributor

@copilot Make sure you add tests.

…ngCompanyInfo

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot Make sure you add tests.

Done in d7d4ce4. Added two tests in EDocHelperTest.Codeunit.al:

  • ValidateReceivingCompanyInfoWithMatchingServiceParticipant: Verifies that validation succeeds when a matching Company Service Participant exists
  • ValidateReceivingCompanyInfoFallsBackToVATWhenNoServiceParticipant: Verifies fallback to VAT/GLN matching when no Service Participant matches

Copy link
Contributor

@Groenbech96 Groenbech96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build: ./src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al#L315
AA0175 Variable 'ServiceParticipant' queries the database in 'MatchCompanyByServiceParticipant' but does not use the queried record. Only find or get record if you need to access the values. Consider using ISEMPTY.

…ence

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

Build: ./src/Apps/W1/EDocument/App/src/Helpers/EDocumentImportHelper.Codeunit.al#L315
AA0175 Variable 'ServiceParticipant...

Fixed in 2774d26. Changed FindFirst() to not IsEmpty() since we only need to check if a matching record exists.

@Groenbech96 Groenbech96 requested a review from a team as a code owner January 29, 2026 20:33
@Groenbech96
Copy link
Contributor

@copilot Take a look at the new instructions

Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot Take a look at the new instructions

Could you clarify what new instructions you're referring to? I don't see any additional instructions in the comments.

@Groenbech96
Copy link
Contributor

@copilot revert my latest commit.

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot revert my latest commit.

Done in 7d5b8fa. Reverted the AGENTS.md commit.

@Groenbech96
Copy link
Contributor

@copilot

Build: ./src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al#L119AL0118 The name '"Service Integration"' does not exist in the current context. -- Build: ./src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al#L76AL0118 The name '"Service Integration"' does not exist in the current context. [Build: ./src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al#L119](https://github.com//pull/6372/files#annotation_44933495907) AL0118 The name '"Service Integration"' does not exist in the current context. [Build: ./src/Apps/W1/EDocument/Test/src/Receive/EDocHelperTest.Codeunit.al#L76](https://github.com//pull/6372/files#annotation_44933495917) AL0118 The name '"Service Integration"' does not exist in the current context.

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot

...

Fixed in 33dda72. Added missing using Microsoft.eServices.EDocument.Integration; statement to resolve the Service Integration enum reference.

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

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants