Thursday, December 15, 2016

Update the fetchXML that will be used by the Sub- grid in Dynamics CRM

///<reference path="XrmPage-vsdoc.js"/>
function UpdateSubGrid()
{
 window.scroll(0,0);
 var rereferralsGrid = document.getElementById("rereferrals");
 var lookupfield = new Array;
 lookupfield = Xrm.Page.getAttribute("ftd_familymember").getValue();
 intakeid = Xrm.Page.getAttribute("safy_intakeid").getValue();

 if (lookupfield != null)
 {
     var lookupid = lookupfield[0].id;
 }

else
 {
    return;
 }


if (rereferralsGrid ==null || rereferralsGrid.readyState != "complete")
{
    setTimeout('UpdateSubGrid()', 2000);
    return;
}   

 //Update the fetchXML that will be used by the grid.
 var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" 
 fetchXml += "<entity name='ftd_intakeassessment'>";
 fetchXml += "<attribute name='safy_intakeassessment'/>";
 fetchXml += "<attribute name='ftd_intakeassessmentid' />";
 fetchXml += "<attribute name='safy_intakeid' />";
 fetchXml += "<attribute name='safy_ica_status_reason' />";
 fetchXml += "<attribute name='safy_ica_status' />";
 fetchXml += "<attribute name='safy_ica_provider_worker_name' />";
 fetchXml += "<attribute name='safy_ica_name' />";
 fetchXml += "<attribute name='safy_ica_intake_office' />";
 fetchXml += "<attribute name='safy_familymembername' />";
 fetchXml += "<attribute name='safy_ica_assess_supervisor' />";
 fetchXml += "<order attribute='safy_intakeid' descending='false' />";
 fetchXml += "<filter type='and'>";
 fetchXml += "<condition attribute='safy_initialassessment' operator='eq' value='1' />";
 fetchXml += "<condition attribute='safy_intakeid' operator='ne' value='"+ intakeid +"' />"
 fetchXml += "<condition attribute='ftd_familymember' operator='eq' uiname='Family Member' uitype='ftd_familymember' value='" + lookupid + "' />";
 fetchXml += "</filter>";
 fetchXml += "</entity>";
 fetchXml += "</fetch>";

 rereferralsGrid.control.SetParameter("fetchXml", fetchXml);
 rereferralsGrid.control.refresh();
}

No comments:

Post a Comment

Get files of last hour in Azure Data Factory

  Case I have a Data Factory pipeline that should run each hour and collect all new files added to the data lake since the last run. What is...