Update Subcontracting Sync tests to use Component Supply Method API#8505
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix Subcontracting Test compilation errors
Update Subcontracting Sync tests to use Component Supply Method API
Jun 5, 2026
ChethanT
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subcontracting test compilation broke because
Subcontracting Typereferences remained after the model/API rename toComponent Supply Method. This updatesSubcSubcontractingSyncTestto align with current enum values, record fields, and library procedure names.API call alignment in Sync tests
UpdateProdBomWithSubcontractingType(...)withUpdateProdBomWithComponentSupplyMethod(...)."Subcontracting Type"::Transferto"Component Supply Method"::"Transfer to Vendor".Prod. Order Component field rename alignment
SetAllProdOrderTransferComponentLocations, replaced filter on removed"Subcontracting Type"with"Component Supply Method"and corresponding enum value.Scope
src/Apps/W1/Subcontracting/Test/src/Codeunits/Tests/SubcSubcontractingSyncTest.Codeunit.alOriginal prompt
Problem
The CI/CD build fails during compilation of the Subcontracting Test project (
src/Apps/W1/Subcontracting/Test) with these errors:Failing job: https://github.com/microsoft/BCApps/actions/runs/26949370499/job/79513223637
Root Cause
The
"Subcontracting Type"enum has been removed/renamed to"Component Supply Method"(defined insrc/Apps/W1/Subcontracting/App/src/Process/Enumerations/ComponentSupplyMethod.Enum.al), and the old enum value"Subcontracting Type"::Transfernow corresponds to"Component Supply Method"::"Transfer to Vendor".The
Subc. Management Librarycodeunit (src/Apps/W1/Subcontracting/Test/src/Codeunits/Libraries/SubcManagementLibrary.Codeunit.al) already has the correct replacement procedureUpdateProdBomWithComponentSupplyMethod(line 77), but the test file still calls the oldUpdateProdBomWithSubcontractingType.Required Changes
All changes are in file:
src/Apps/W1/Subcontracting/Test/src/Codeunits/Tests/SubcSubcontractingSyncTest.Codeunit.al1. Line 143 — Replace call to removed procedure
Before:
After:
2. Line 213 — Same replacement (second test procedure)
Before:
After:
3. Line 488 — Replace removed field on Prod. Order Component record
In the
SetAllProdOrderTransferComponentLocationslocal procedure:Before:
After:
Verification
"Component Supply Method"enum is already available via theusing Microsoft.Manufacturing.Subcontracting;import at line 22 of the test file.UpdateProdBomWithComponentSupplyMethodprocedure already exists in theSubc. Management Librarycodeunit (line 77 ofSubcManagementLibrary.Codeunit.al) and takes the same pattern of parameters (Item record + enum value)."Prod. Order Component"record already has a"Component Supply Method"field (used throughout the app code in pages, reports, and codeunits).The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: ## Compilation Failure in "Subcontracting Test" Project
The build fails during compilation of the Subcontracting Test project with these errors:
AL0132'Codeunit "Subc. Management Library"' does not contain a definition for 'UpdateProdBomWithSubcontractingType'AL0118The name '"Subcontracting Type"' does not exist in the current context.AL0132'Record "Prod. Order Component"' does not contain a definition for 'Subcontracting Type'Root Cause
The Subcontracting Test project references:
UpdateProdBomWithSubcontractingTypein theSubc. Management Librarycodeunit that no longer exists (likely renamed or removed)."Subcontracting Type"on the"Prod. Order Component"record that has been removed or renamed in the main Subcontracting app.This indicates the main Subcontracting app had a breaking change (field/procedure rename or removal) but the test project was not updated to match.
Solution
You need to update the test files to align with the current Subcontracting app API:
In
Subc. Management Library(test helper codeunit): Either re-add theUpdateProdBomWithSubcontractingTypeprocedure or, if the underlying logic was renamed, add the new equivalent procedure and update all callers.In the test files referencing
"Subcontracting Type": Replace the field reference with whatever the field was renamed to in the"Prod. Order Component"table.For example, if the field was renamed to something like
"Subcontracting Work Type", the fix would look like: