MB-500 · Question #240
A company uses Dynamics 365 Finance. You must create a process that updates the following: - A single record for customer number A0001 in the customer table. - The value of its customer group to 10…
The correct answer is D. select forupdate custTable where custTable.AccountNum == 'A0001'; ttsbegin; custTable.CustGroup = '10'; custTable.update(); ttscommit. Option D is the only choice that includes all three required elements: forupdate (which locks the record and permits modification), a where clause targeting the specific customer (AccountNum == 'A0001'), and a properly wrapped transaction using ttsbegin/ttscommit around the…
Question
Exhibit
Options
- Aselect forupdate custTable where custTable.AccountNum == 'A0001'; custTable.CustGroup = '10'; custTable.update();
- Bselect forupdate custTable; ttsbegin; custTable.CustGroup = '10'; custTable.update(); ttscommit;
- Cselect custTable where custTable.AccountNum == 'A0001'; custTable.CustGroup = '10'; custTable.update(); ttscommit;
- Dselect forupdate custTable where custTable.AccountNum == 'A0001'; ttsbegin; custTable.CustGroup = '10'; custTable.update(); ttscommit;
How the community answered
(33 responses)- A3% (1)
- B9% (3)
- C3% (1)
- D85% (28)
Explanation
Option D is the only choice that includes all three required elements: forupdate (which locks the record and permits modification), a where clause targeting the specific customer (AccountNum == 'A0001'), and a properly wrapped transaction using ttsbegin/ttscommit around the actual data change and update() call.
Option A fails because it omits ttsbegin/ttscommit - without a transaction block, the update() call will throw a runtime error in X++, since record updates require an explicit transaction.
Option B is wrong because it lacks the where clause on the select, meaning it targets an unfiltered (first) record rather than customer A0001 specifically.
Option C is missing the forupdate keyword on the select and is missing ttsbegin - without forupdate, the record is read-only and cannot be updated, and without ttsbegin, there is no open transaction to commit.
Memory tip: Think of the acronym FWT - ForUpdate (lock it), Where (find it), Transaction (commit it). Any answer missing one of those three is wrong.
Topics
Community Discussion
No community discussion yet for this question.
