Getting Parent Entity Information from child

In MS CRM 4.0 we used to get parent entity information using window.opener which is not there in CRM 2011 now. In CRM 2011 you can use below code

window.top.opener.parent.Xrm.Page

so using this statement you can get parent entity information and can fetch parent entity data, but sometime we also need to check parent entity name, let’s take an example of order, we can create order from opportunity form, we can create it from account form as well. So in that case if we need to check which is the parent entity in order form we can use below statement to check entity name

if(window.top.opener.parent.Xrm.Page.data!=null)
var EntyName=window.top.opener.parent.Xrm.Page.data.entity.getEntityName();

enjoy !!

Reference

9 thoughts on “Getting Parent Entity Information from child

Leave a Reply

Your email address will not be published. Required fields are marked *