I have a requirement to hide a button in the ribbon if the form is dirty (i.e. in a state of unsaved).
I know I can use a function calling the getIsDIrty() method, but I am unable to get this working.
I have created a custom enable rule as below with the function below.
I understand I may have the Invert Result wrong, but whichever way I try I do not see the button. (Note I also have a rule that on create this button is hidden).
Do I need to make use of RefreshRibbon somewhere to pick up the new rules?. If so where can I use this so it gets fired?
function checkUnsavedChanges(primaryControl)
{
return Xrm.Page.data.entity.getIsDirty();
}