Sales invoice SSRS report CoC: avoid self-recursion
Short answer
B The solution re-calls populateSalesInvoiceHeaderFooterTmp inside its own Chain of Command wrapper, causing infinite recursion instead of chaining with next.
Question
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
A company is using a Dynamics 365 finance and operations app.
The accounting department requests two custom fields named CusStatus and CusDiscount for the header of the sales invoice SSRS report. The custom fields are in the SalesTable table.
You create a duplicate of the report design and add the two new fields to a temporary table by using the following extension:

You need to populate the new fields by using Chain of Command (CoC).
Solution: Declare the SalesTable table on line 06 and insert a new line after line 06 to declare the SalesInvoiceHeaderFooterTmp table. Populate the new fields by calling the method populateSalesInvoiceHeaderFooterTmp on line 08.
Does the solution meet the goal?
Key Takeaways
The trap is self-recursion: an unqualified call to populateSalesInvoiceHeaderFooterTmp inside the CoC wrapper of that same method re-enters the wrapper instead of reaching the base implementation.
This MB-500 scenario tests a Chain of Command extension on the sales invoice SSRS report that must populate CusStatus and CusDiscount. The correct verdict is B (No), because the proposed solution calls the very method it wraps instead of chaining with next.
Common mistake: Choosing A (Yes) because the solution does declare SalesTable, declare SalesInvoiceHeaderFooterTmp and call a populate method — the error is that the call re-enters the wrapped method rather than using next.
Expert Analysis
The recursion trap
The most attractive reading is that the solution satisfies the scenario literally: the CoC extension does declare SalesTable, adds a declaration for SalesInvoiceHeaderFooterTmp, and calls populateSalesInvoiceHeaderFooterTmp to fill the new CusStatus and CusDiscount fields. Every element the goal mentions appears to be present, so the solution looks complete at a glance.
The single point where it breaks is the call site. The extended method is populateSalesInvoiceHeaderFooterTmp — the CoC wrapper wraps that exact method so it can invoke next.populateSalesInvoiceHeaderFooterTmp(...) and then append the custom fields to the temporary table that backs the duplicated report design. Inserting a fresh call to populateSalesInvoiceHeaderFooterTmp inside its own wrapper re-enters the wrapper itself, because in X++ Chain of Command the unqualified call inside the extension resolves back into the extended method rather than to the base implementation. Execution therefore loops indefinitely, producing a stack-overflow style failure before any invoice data reaches the report.
The correct pattern is to let the original work happen through next.populateSalesInvoiceHeaderFooterTmp(...), then read SalesTable fields and write CusStatus and CusDiscount into the already-populated SalesInvoiceHeaderFooterTmp buffer. Declaring SalesTable on line 06 and declaring the temp table are harmless and even necessary steps; they are not what invalidates the solution.
Because the proposed solution re-enters the wrapped method instead of chaining to it, the answer is B. No — the solution does not meet the goal.
Exam Strategy
When a Chain of Command solution proposes calling the same method it is extending, read it as a self-recursion trap and expect "No" unless the call is qualified with next. Use the scenario's stated goal as the test: verify the data actually reaches the report's temporary table, not merely that the required declarations and method calls exist. Multi-part question sets like this one often reward spotting the single fatal detail rather than counting correct-looking steps.
Frequently Asked Questions
Why does calling populateSalesInvoiceHeaderFooterTmp inside its CoC extension cause infinite recursion?
How should the custom CusStatus and CusDiscount fields be added to the duplicated report design?
Is declaring SalesTable and SalesInvoiceHeaderFooterTmp in the extension harmful?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 1 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 1
-
cbef765 👍 1 Answered BAnswer: B. No Why: The problem is calling populateSalesInvoiceHeaderFooterTmp again on line 08. You’re already inside that method, because it’s the one being wrapped. 1. It calls itself, which causes infinite recursion. Calling
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All MB-500 Questions
Access 115 questions with complete answers and detailed explanations.
View Full MB-500 Practice Test →