Thursday, September 1, 2011

Xrm.Page.ui Not Available on Primary Grid

 

While developing an EnableRule for some new functionality I decided to use an Async call.  Here is a great link on how to use Async calls with EnableRule.

http://myencounterwithcrm.wordpress.com/2011/06/09/walkthrough-of-asynchronous-call-from-customrule-ribbondiff/

Microsoft even notes this strategy in the SDK documentation: 
test

Consider that Microsoft sees this as the “proper way” to do things you might think that they would provide the necessary methods to complete this, that would only be half correct.

All of this works if you are on an entity form because Xrm.Page.ui.refreshRibbon() is available.  Unfortunately if you are in a grid such as the one displayed below, Xrm.Page.ui is null, which means you cannot call the refreshRibbon() method.

test2

DAGGER!!!!!!

If anyone knows a way in which to get around this please leave a comment Smile

2 comments:

MK said...

Hi,

Use either window.parent.Xrm.Page.ui or window.top.opener.parent.Xrm.Page.ui

This should give you handler to Page.ui

HTH

Rick Wilson said...

Unfortunately that doesn't work in the primary grid page. As I noted in the post the Page.ui object for the grid does not contain the Refreshribbon() function. That is only available in entity forms. I do agree thought that your solution is good while working on entity forms, thanks for posting.