Hi Friends,
I am using below code to populate related Client Assistive Devices records of the client in the The other form as subgrid. That part is working fine but when if client has no Assistive devices we need to add records by clicking + sign on subgrid. When i click plus sign i want the same client name to be pull forward. Any ideas for this. I have this subgrid in the other custom entity called Evaluation Form.
function FilterSubgrid() {
var EquipmentGrid = document.getElementById("Equipment");
var Clientid = new Array;
var Clientid = Xrm.Page.getAttribute("ban_clientnmae").getValue();
if (Clientid != "" ) {
if (EquipmentGrid == null || EquipmentGrid.readyState != "complete") {
setTimeout('FilterSubgrid()', 2000);
return;
}
var Clientid = Clientid[0].id;
var fetchXml = "<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>";
fetchXml += "<entity name='ban_clientassistivedevices'>";
fetchXml += "<attribute name='ban_assistivedevice'/>";
fetchXml += "<attribute name='statecode'/>";
fetchXml += "<attribute name='ban_otherdevice'/>";
fetchXml += "<attribute name='ban_clientassistivedevicesid'/>";
fetchXml += "<order descending='false' attribute='ban_assistivedevice'/>";
fetchXml += "<link-entity name='contact' alias='af' to='ban_client' from='contactid'>";
fetchXml += "<filter type='and'>";
fetchXml += "<condition attribute='contactid' ";
fetchXml += "value='" + Clientid + "'";
fetchXml += " operator='eq'/></filter>";
fetchXml += "</link-entity>";
fetchXml += "</entity></fetch>";
EquipmentGrid.control.SetParameter("fetchXml", fetchXml);
EquipmentGrid.control.refresh();
}
}