PL-400 · Question #156
PL-400 Question #156: Real Exam Question with Answer & Explanation
The correct answer is B: formContext.ui.refreshRibbon(refreshAll);. To make a ribbon button conditionally visible based on business rules, the ribbon's enable/display rules must be re-evaluated. This is triggered by calling formContext.ui.refreshRibbon(). Option D - formContext.ui.refreshRibbon() - calls the refresh with no argument, re-evaluatin
Question
An organization uses Dynamics 365 Sales. You plan to add a custom button to the app ribbon. You need to ensure that the button displays only when conditions specified by business rules are met. Which two code segments can you use? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point.
Options
- AgridContext.refresh();
- BformContext.ui.refreshRibbon(refreshAll);
- CformContext.data.refresh(save).then(successCallback, errorCallback);
- DformContext.ui.refreshRibbon();
- EformContext.getControl(arg).refresh();
Explanation
To make a ribbon button conditionally visible based on business rules, the ribbon's enable/display rules must be re-evaluated. This is triggered by calling formContext.ui.refreshRibbon(). Option D - formContext.ui.refreshRibbon() - calls the refresh with no argument, re-evaluating all ribbon rules. Option B - formContext.ui.refreshRibbon(refreshAll) - calls it with true, forcing a full refresh of all ribbon elements including those that may be cached. Both are valid ways to trigger ribbon rule re-evaluation. Option A (gridContext.refresh()) refreshes a grid, not the ribbon. Option C (formContext.data.refresh(save)) saves/refreshes form data. Option E (formContext.getControl(arg).refresh()) refreshes a specific form control, not the ribbon.
Community Discussion
No community discussion yet for this question.