Wednesday, 28 March 2012

Xrm.Page.ui is null, Xrm.Page.data is null, Xrm.Page.data.entity.getId() is null for navigation subgrid javascript

I was trying to add enable role on ribbon button of a Entity B which is shown when I click on the navigation link of entity A. In the custom javascript I needed the Entity A id, and Xrm.Page.data.entity.getId() was not available,and same was the case with Xrm.Page.data and Xrm.Page.ui.

After doing bit of investigation, I found out that the javascript conext for ribbon bar is running in iframe of entity B, and to access the entity A values I have to use window.parent.Xrm.Page.data.entity.getId()


http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/8cfe6ff6-7569-48e2-b87e-359280204162/

2 comments: