nerdexam
Microsoft

MB-500 · Question #275

You extend the insert method of the CustTable by using Chain of Command. You need to print a message after creating a record if the Sales tax group is complete. Which code segment should you use? A…

The correct answer is A. [ExtensionOf(tableStr(CustTable))] final class CustTable_Extension { void insert(DirPartyType _partyType, Name _name, boolean _updateCRM) { if (this.TaxGroup) { info('The customer has a sales tax group.'); } } }. Important Note: The Stated Answer Appears Incorrect The exam marks A as correct, but based on Chain of Command (CoC) principles in X++/Dynamics 365, C is the technically correct answer. Here's why: --- Why C is Correct In X++ Chain of Command, next methodName() is mandatory…

Develop business logic

Question

You extend the insert method of the CustTable by using Chain of Command. You need to print a message after creating a record if the Sales tax group is complete. Which code segment should you use? A. B. C. D.

Exhibits

MB-500 question #275 exhibit 1
MB-500 question #275 exhibit 2
MB-500 question #275 exhibit 3
MB-500 question #275 exhibit 4

Options

  • A[ExtensionOf(tableStr(CustTable))] final class CustTable_Extension { void insert(DirPartyType _partyType, Name _name, boolean _updateCRM) { if (this.TaxGroup) { info('The customer has a sales tax group.'); } } }
  • B[ExtensionOf(tableStr(CustTable))] final class CustTable_Extension { void insert(DirPartyType _partyType, Name _name, boolean _updateCRM) { if (this.TaxGroup) { info('The customer has a sales tax group.'); } } next insert(_partyType, _name, _updateCRM); }
  • C[ExtensionOf(tableStr(CustTable))] final class CustTable_Extension { void insert(DirPartyType _partyType, Name _name, boolean _updateCRM) { next insert(_partyType, _name, _updateCRM); if (this.TaxGroup) { info('The customer has a sales tax group.'); } } }
  • D[ExtensionOf(tableStr(CustTable))] final class CustTable_Extension { void insert(DirPartyType _partyType, Name _name, boolean _updateCRM) { try { if (!this.TaxGroup) { throw Exception::Error; } } catch (Exception::Error) { throw error('An error occurred'); } finally { info('The customer has a sales tax group.'); } } next insert(_partyType, _name, _updateCRM); }

How the community answered

(23 responses)
  • A
    52% (12)
  • B
    26% (6)
  • C
    13% (3)
  • D
    9% (2)

Explanation

Important Note: The Stated Answer Appears Incorrect

The exam marks A as correct, but based on Chain of Command (CoC) principles in X++/Dynamics 365, C is the technically correct answer. Here's why:


Why C is Correct

In X++ Chain of Command, next methodName() is mandatory - it calls the next method in the chain (i.e., the original base insert logic that actually creates the record). Option C calls next insert() first to create the record, then checks this.TaxGroup and prints the info message after the record exists. This directly satisfies the requirement: "print a message after creating a record."

Why the Other Options Fail

  • A - Missing next insert() entirely. The base insert logic never runs, so no record is ever created. This breaks the fundamental CoC contract.
  • B - next insert() is placed outside the method body (after the closing brace), making it syntactically invalid and unreachable.
  • D - Uses try/catch/finally incorrectly; the info() call is in finally, meaning it fires regardless of whether TaxGroup is populated. Also, next insert() is outside the method body.

Memory Tip

Think of CoC like a relay race: you must pass the baton (next method()) to keep the chain alive. Place your custom logic after next if you need to act on the saved record, and before next if you need to modify data before saving.

If this question appears on your actual exam, C is the defensible answer - the omission of next insert() in A would cause a runtime failure, not a valid extension.

Topics

#Chain of Command#CoC extension#next keyword#table method override

Community Discussion

No community discussion yet for this question.

Full MB-500 Practice