Hi All,
I have one requirement which says, There is a lookup field "Product". One product have many "lots numbers".
Whenever user selects any product, its respective lots numbers details should get visible in "Inline Lookup view" of sub-grid. From "Inline lookup view" of subgrid user can further select his desired "Lot No".
Here is my Javascript Code:
---------------------------------------------------------------------------------------------------------
function getProductsDetails() { debugger; var grid = Xrm.Page.ui.controls.get("ListLotsSubgridQuotes"); if (grid.getVisible() == false) { setTimeout("getProductsDetails();", 2000); return; } else if (grid.getVisible() == true) { alert("grid loaded"); var lookupObj = Xrm.Page.getAttribute("productid"); //Check for Lookup Object if (lookupObj != null) { var lookupObjValue = lookupObj.getValue();//Check for Lookup Value if (lookupObjValue != null) { var lookupEntityType = lookupObjValue[0].entityType, //To get EntityName lookupRecordGuid = lookupObjValue[0].id, // To get record GUID lookupRecordName = lookupObjValue[0].name; //To get record Name alert(lookupRecordGuid); var fetchXmlPL = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"; fetchXmlPL += "<entity name='new_productitemlistlots'>"; fetchXmlPL += "<attribute name='new_name' />"; fetchXmlPL += "<attribute name='new_vessel' />"; fetchXmlPL += "<attribute name='new_total_estimated_cost' />"; fetchXmlPL += "<attribute name='new_total_actual_cost' />"; fetchXmlPL += "<attribute name='new_countryoforigin' />"; fetchXmlPL += "<attribute name='new_brand' />"; fetchXmlPL += "<attribute name='new_productitemlistlotsid' />"; fetchXmlPL += "<order attribute='new_name' descending='false' />"; fetchXmlPL += "<filter type='and'>"; fetchXmlPL += "<condition attribute='new_productno' operator='eq' uiname='" + lookupRecordName + "' uitype='product' value='" + lookupRecordGuid + "' />"; fetchXmlPL += "</filter>"; fetchXmlPL += "</entity>"; fetchXmlPL += "</fetch>"; var viewId = "{00000000-0000-0000-0000-000000000001}"; var entName = "new_productitemlistlots"; var vwName = "List Lot Resources"; var resFetch = fetchXmlPL; var resLayout = "<grid name='resultset' object='4230' jump='name' select='1' icon='1' preview='1'><row name='result' id='userqueryid'><cell name='name' width='300' /><cell name='ownerid' width='100' /><cell name='modifiedon' width='100' /></row></grid>"; //Set the view using ContactsIFollow var ProductsIFollow = { entityType: "product", // SavedQuery id: "{F814628E-114D-E711-80FF-5065F38A4B41}", name: "Products I Follow" } Xrm.Page.getControl("ListLotsSubgridQuotes").getViewSelector().setCurrentView(ProductsIFollow); grid.refresh(); } } return; } }
-------------------------------------------------------
I am not able to set FETCHXML to the sub-grid. Also not able to set custom view to the sub-grid.
Kindly help as I got stuck in this very badly.
Thanks a lots.
Regards
Kavita
*This post is locked for comments