Model-Driven App Trick : How to Hide a Ribbon Button when the Form is Dirty


This article discusses how to display a custom ribbon button only when a form has no unsaved changes in a model-driven app. The article covers both the Classic Ribbon and Modern Commanding extension models. For the Classic Ribbon, the form's state can be checked using the `formContext.data.entity.getIsDirty()` method, and a JavaScript function can be created to determine whether the button should be shown or not. The button's enable rule can then be configured in the Ribbon Workbench. For the Modern Commanding model, the visibility rule can be expressed using the PowerFx expression `Not(Self.Selected.Unsaved)`. The article also provides a solution for refreshing the ribbon on form change.


Article 1m

Login now to access my digest by 365.Training

Learn how my digest works
Features
  • Articles, blogs, podcasts, training, and videos
  • Quick read TL;DRs for each item
  • Advanced filtering to prioritize what you care about
  • Quick views to isolate what you are looking for right now
  • Save your favorite items
  • Share your favorites
  • Snooze items you want to revisit when you have more time