Search code examples
dynamics-crm-2011ribbon-control

Refreshing Ribbon in CRM on home screen (no entity form open)


On my home screen, I have a button for Login and a button for Logout. Initially, the button Login is Enabled and Logout is disabled. On click of Login button, i make an AJAX call and login the user to a system. Now, on this, i want the Logout button to be clickable and want to grayout the Login button. I have a corresponding javascript written. However, i want to refresh the Ribbon button. How do i do that?

when i try Xrm.Page.ui.refreshRibbon, it breaks saying refreshRibbon is invalid. When i tried watching Xrm.Page.ui.. it returns NULL.


Solution

  • I think you are already in the XRM Ribbon Context so you can use the XRM Ribbon Related functions directly in the Ribbon button's JS.

    try

    window.refreshRibbon()