This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
A service must run a codeunit conditionally and inspect whether it succeeds. The caller has already modified data in a write transaction. Which design is correct?
Consume the Boolean result without committing because Codeunit.Run rolls back the caller transaction.
Codeunit.Run
Omit the Boolean result and inspect GetLastErrorText after any failure.
GetLastErrorText
Call Commit(), consume the Boolean result from Codeunit.Run, and handle a false result.
Commit()
An extension needs one selected pricing algorithm and also allows unrelated extensions to react after a price is calculated. Which design best separates these needs?
Publish one event and depend on subscriber order to select the algorithm before other subscribers run.
Select the algorithm through an interface-backed enum, and publish an integration event after calculation.
Call every pricing codeunit directly, and let each codeunit decide whether its result applies.
An upgrade converts legacy extension data, but the same upgrade code might run again in another upgrade session. Which approach protects the data?
Check a uniquely named upgrade tag, perform a repeatable conversion, and set the tag after success.
Check only the app version, delete the legacy rows, and assume the upgrade code runs once.
Move the conversion into an install codeunit because install code also runs during version upgrades.
A scheduled processing codeunit changes an entry and then raises a nonretriable error. A failure codeunit is configured. What outcome should the developer expect?
The entry change commits, the task is removed immediately, and the failure codeunit runs in the same transaction.
The task pauses for a user dialog because the background session inherits the scheduling page.
The main transaction rolls back, the current session ends, and the failure codeunit runs in a new session and transaction.
You must answer all questions before checking your work.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?