Hello Friends,
I want to show all the campaign response created against particular contact in sub-grid on contact form.
I have visited many articled which all are just specifying a single possible way to do. For instance take a look at this article from Hosks.
when I tried to apply same in my code, all the time fetchXML in grid is getting assigned fairly well but grid isn't refreshing and showing filtered data. it always shows "Grid refresh failed!".
Please take a look at my jscript code registered on contact form load event.
function updateSubGrid() { var relatedProducts = document.getElementById("CampaignResponse"); var contactid = Xrm.Page.data.entity.getId(); if (relatedProducts == null || relatedProducts.readyState != "complete") { setTimeout('updateSubGrid()', 2000); return; } //This is the fetch xml code which will retrieve all the order products related to the order selected for the case. var fetchXml; fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"; fetchXml += "<entity name='campaignresponse'>"; fetchXml += "<attribute name='subject' />"; fetchXml += "<attribute name='activityid' />"; fetchXml += "<attribute name='regardingobjectid' />"; fetchXml += "<attribute name='responsecode' />"; fetchXml += "<attribute name='prioritycode' />"; fetchXml += "<order attribute='subject' descending='false' />"; fetchXml += "<link-entity name='activityparty' from='activityid' to='activityid' alias='aa'>"; fetchXml += "<filter type='and'>"; fetchXml += "<condition attribute='partyid' operator='eq' uitype='contact' value='" + contactid + "' />"; fetchXml += "</filter>"; fetchXml += "</link-entity>"; fetchXml += "</entity>"; fetchXml += "</fetch>"; relatedProducts.control.setParameter("fetchXml", fetchXml); relatedProducts.control.refresh(); }
Let me hear your views or any alternate useful to my requirement.
Thanks and regards,
Hiren Solanki.
Please vote or mark as a answer if it helped you.