Archive

Archive for the ‘Associated View’ Category

Linking Associated Views from non-linked Entities

January 21, 2012 Leave a comment

In CRM 2011, relationship(1:N) must be exists to show associated records from linked entity.

Such records can be shown as Sub-Grid or on Form Sub-Grid. However at times we might have to show up data from related entities where there is no CRM relationship exists between the entities. This scenario is more prominent where there is integration between multiple CRM instances.

I found one way to do this. Following URL can be used to set a Read-Only CRM Entity form

http://SERVER Name/ORG NAME/userdefined/areas.aspx?

Query String Parameters

Parameter Value Comments
oId UniqueIdentifier GUID of the Foreign Key
oType Numeric Entity Type code for entity for which data needs to be shown
security This can be any non-negative number I could not find out exact purpose of this parameter but taking this parameter out cause error. So we have to give some numeric value for this parameter
tabSet SchemaName of relationship This information can be copied from Relationships section of Entity Customization.

 

Example:

http://CrmWeb01/PWB/userdefined/areas.aspx?oId=%7bC671558A-34C5-4473-9344-94E85D7540AC%&oType=10000&pagemode=iframe&security=852023&tabSet=new_partner_new_cert_MPartner

 

Calling URL in IFrame: In above given URL query parameter oId is only parameter which needs to be dynamically set depending upon parent entity Id. For this I created a HTML Web Resource and added a IFrame in it. Following JavaScript function reads GUID value and sets it in URL

<script type=”text/javascript” language=”javascript”>

function OnFormLoad() {
if (window.parent.Xrm.Page.getAttribute(‘gsx_gsxguid’).getValue() != null) {

var gsxGuid = window.parent.Xrm.Page.getAttribute(‘gsx_gsxguid’).getValue();
var gsxFrame = document.getElementById(“gsxIframe”);

gsxFrame.src = http://ServerName/OrgName/userdefined/areas.aspx?oId=%7b + gsxGuid + “%7d&oType=10030&security=0&tabSet=new_partner_new_cert_MPartner”;
}
else {
alert(“gsx_gsxguid is NULL !!”);
}
}

</script>

Screenshot.

Here is how it looks

image

 

Hope this helps you.

Categories: Associated View, CRM 2011
Follow

Get every new post delivered to your Inbox.