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

Misbehaviour of scripts in Hub View

$
0
0

Hi All,

The scenario is like I have 2 account form (Parent-Child account). I am creating the cases from the child account form using subgrid of case entity.

Also, I have another subgrid on the Parent account form which is used to display all the cases which are made under the related child account record.

So for this, I implement a JS code to show all the cases made under the related child account on the Parent Account Form within another Case Subgrid.

Code is given below: -

function DisplayCases() {

// get Contacts Sub grid
var accountChildCasesGrid = window.parent.document.getElementById("CasesRelatedtoSites")


// Get the ID of the current account
var rootAccountID = Xrm.Page.data.entity.getId();

// Check that the subgrid is ready
if (accountChildCasesGrid == null){
setTimeout('DisplayCases()',1000);
return;
}

// Construct FetchXML for contacts in this account and its child accounts
var fetchXml = "<fetch version='1.0' mapping='logical'>";
fetchXml += "<entity name='incident'>";
fetchXml += "<attribute name='title'/>";
fetchXml += "<attribute name='customerid'/>";
fetchXml += "<attribute name='statecode'/>";
fetchXml += "<order attribute='title' descending='false' />";
fetchXml += "<link-entity name='account' from='accountid' to='customerid' link-type='inner' >";
fetchXml += "<filter type='and'>";
fetchXml += "<condition attribute='accountid' operator='eq-or-under' value='" + rootAccountID + "' />";
fetchXml += "<condition attribute='accountid' operator='not-null' />";
fetchXml += "</filter>";
fetchXml += "</link-entity>";
fetchXml += "</entity>";
fetchXml += "</fetch>";

// Layout of subgrid.
var LayoutXml = "<grid name='resultset' object='8' jump='new_name' select='1' preview='1' icon='1'>" +
" <row name='result' id='new_boat'>" +
"<cell name='title' width='100' />" +
"<cell name='customerid' width='100' />" +
"<cell name='statecode' width='100' />" +

"</row>" +
"</grid>";


// make sure control is ready and set data and refresh the subgrid
if (accountChildCasesGrid.control != null){
accountChildCasesGrid.control.SetParameter("fetchXml", fetchXml);
accountChildCasesGrid.control.refresh();
}
else{
setTimeout('DisplayCases()',1000);
}
}

So problem is only that this script is working as expected in standard view but not in Hub View.

Please suggest for the same.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



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