MB-230 Extend Customer Service Practice Question
You are extending Dynamics 365 Customer Service by creating a custom JavaScript function that runs on the Case form's OnSave event. The function must call an external REST API to validate the customer's credit status and, if validation fails, prevent the save and display an error message. Which approach should you use to prevent the save?
⚠ Common exam trap
The trap here is assuming that returning false from the OnSave function or using rollback() will prevent the save, when in fact only preventDefault() on the event arguments can cancel the save operation.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use executionContext.getEventArgs().preventDefault() inside the OnSave handler if validation fails.
The correct approach is to use executionContext.getEventArgs().preventDefault() in the OnSave handler. This method cancels the save operation and allows you to display an error message. Other options do not prevent the save or use unsupported methods that may lead to data being saved despite validation failure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set the form's dirty state to false and return false from the OnSave function.
Why it's wrong here
Setting the dirty state to false does not prevent the save; it only indicates that the form has no unsaved changes. Returning false from the OnSave function is not a supported way to cancel the save in Dynamics 365. The correct method is to use preventDefault on the event arguments. This option is a common misconception and will not stop the save.
- ✓
Use executionContext.getEventArgs().preventDefault() inside the OnSave handler if validation fails.
Why this is correct
In the OnSave event, you can use executionContext.getEventArgs().preventDefault() to cancel the save operation. This is the supported method to prevent the save when validation fails. The function must be registered as an OnSave handler and receive the execution context. This approach allows you to display an error message and stop the save from proceeding, ensuring data integrity.
- ✗
Use Xrm.Navigation.openAlertDialog to display an error and then call Xrm.Page.data.entity.rollback() to revert changes.
Why it's wrong here
Xrm.Navigation.openAlertDialog displays a message but does not prevent the save. Calling rollback() reverts changes but does not cancel the save operation; the save may still proceed. This approach does not reliably prevent the save and could lead to data inconsistency. The correct method is to use preventDefault on the save event arguments.
- ✗
Register the function as an OnChange handler for the credit status field and use Xrm.Page.ui.setFormNotification to block the save.
Why it's wrong here
OnChange handlers trigger when a field changes, not on save. setFormNotification displays a notification but does not block the save. This approach would not prevent the save when the form is saved. The function must be registered on the OnSave event and use preventDefault to cancel the save. This option misunderstands the event model.
About these practice questions
This MB-230 question is part of Courseiva's 189-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Microsoft exam blueprint
This MB-230 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MB-230 exam.