Sales invoice SSRS report CoC: avoid self-recursion

MB-500 By islever Editorial Last updated

Implement finance and operations app framework functionality Design, create, and revise Dynamics 365 reports

Short answer

B The solution re-calls populateSalesInvoiceHeaderFooterTmp inside its own Chain of Command wrapper, causing infinite recursion instead of chaining with next.

Question

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
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:
Exhibit: Sales invoice SSRS report CoC: avoid self-recursion
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?
  1. Yes
  2. No Correct Answer

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?

The extension method wraps populateSalesInvoiceHeaderFooterTmp itself, so an unqualified call inside the wrapper resolves back into that wrapper. Execution re-enters the extension endlessly instead of reaching the base implementation; use next.populateSalesInvoiceHeaderFooterTmp(...) to chain instead.

How should the custom CusStatus and CusDiscount fields be added to the duplicated report design?

Chain to the original populateSalesInvoiceHeaderFooterTmp with next, then read SalesTable and write CusStatus and CusDiscount into the already-populated SalesInvoiceHeaderFooterTmp buffer that feeds the duplicated design.

Is declaring SalesTable and SalesInvoiceHeaderFooterTmp in the extension harmful?

No. Both declarations are legitimate — you need SalesTable to read the custom fields and SalesInvoiceHeaderFooterTmp to write them to the temp table. The only fatal element is re-calling the wrapped method instead of using next.

Community Votes

B
100%

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

  1. cbef765 👍 1 Answered B
    Answer: 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.

Log in to comment, report an error, or add a note about this question.

Practice All MB-500 Questions

Access 115 questions with complete answers and detailed explanations.

View Full MB-500 Practice Test →

← Back to MB-500 Study Guide