Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Product's grid

$
0
0

Hi all

This is order's form and it has a sub grid Product

I want this grid on Account's form for that

I add sub grid on account's form

and on the web resource I write code 

function filterSubGrid()
{
debugger;
//Xrm.Page.getControl("OrderProduct").refresh();
//Xrm.Page.getControl("OrderProduct").setDisabled(true);
var leadwithSameNameGrid = window.parent.document.getElementById("OrderProduct");
//var leadwithSameNameGrid = document.getElementById("OrderProduct");
var currentleadId = Xrm.Page.data.entity.getId();;
var AccountName = Xrm.Page.getAttribute('name').getValue();

if (leadwithSameNameGrid == null)
{
setTimeout(filterSubGrid, 2000);
return;
}

//fetch xml code
var contactFetchXML ="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
" <entity name='salesorderdetail'>"+
" <attribute name='productname' />"+
" <attribute name='propertyconfigurationstatus' />"+
" <attribute name='primaryunit' />"+
" <attribute name='priceperunit' />"+
" <attribute name='quantity' />"+
" <attribute name='manualdiscountamount' />"+
" <attribute name='extendedamount' />"+
" <attribute name='suggestions' />"+
" <order attribute='productid' descending='false' />"+
" <link-entity name='salesorder' from='salesorderid' to='salesorderid' alias='ay' link-type='inner'>"+
" <filter type='and'>"+
" <condition attribute='statecode' operator='eq' value='3' />"+
" </filter>"+
" <link-entity name='account' from='accountid' to='customerid' alias='az' link-type='inner'>"+
" <filter type='and'>"+
" <condition attribute='accountid' operator='eq' uiname='"+AccountName+"' uitype='account' value='"+currentleadId+"' />"+
" </filter>"+
" </link-entity>"+
" </link-entity>"+
" </entity>"+
"</fetch>"

//var contactRecords = XrmServiceToolkit.Soap.Fetch(contactFetchXML);

if (leadwithSameNameGrid.control != null)
{
leadwithSameNameGrid.control.SetParameter("fetchXml", contactFetchXML); //set the fetch xml to the sub grid
leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml
}
else
{
setTimeout(filterSubGrid, 2000);
}
}

but it is giving me that error when I load my Account's form

Where I am wrong ? I do not know?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>