Hi all! I'm getting the following error message on a field after using the addCustomView call.
Error: "f.get_entityLogicalName is not a function"
If I run my FetchXML in the FetchXML Builder it works perfectly and get the returned results. So I don't know what is causing the issue. My code is as below:
function addCustomRMAProductView(executionContext) { let formContext = executionContext.getFormContext(); let viewID = '{00000000-0000-0000-0000-000000000001}'; let entityName = 'msdyn_rmaproduct'; let viewDisplayName = 'This is a custom view'; let rmaNumberGUID = formContext.getAttribute('po_rma').getValue()[0].id; let rmaNumber = formContext.getAttribute('po_rma').getValue()[0].name; if (!rmaNumber) { console.log("RMA Number not Found. Lookup field not populated"); } else { let fetchXML = "<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\" aggregate=\"true\" >" + "<entity name=\"msdyn_rmaproduct\" >" +"<attribute name=\"msdyn_productname\" aggregate=\"countcolumn\" alias=\"Count\" />" + "<attribute name=\"msdyn_productname\" groupby=\"true\" alias=\"RMAProduct\" />" + "<attribute name=\"msdyn_name\" groupby=\"true\" alias=\"name\" />" + "<attribute name=\"statecode\" groupby=\"true\" alias=\"statecode\" />" + "<attribute name=\"msdyn_rmaproductid\" groupby=\"true\" alias=\"msdyn_rmaproductid\" />" + "<filter type=\"and\" >" + "<condition attribute=\"po_customerasset\" operator=\"null\" />" + "<condition attribute=\"msdyn_itemstatus\" operator=\"eq\" value=\"690970000\" />" + "</filter>" + "<link-entity name=\"msdyn_rma\" from=\"msdyn_rmaid\" to=\"msdyn_rma\" >" + "<filter type=\"and\" >" + "<condition attribute=\"msdyn_rmaid\" operator=\"eq\" uiname=\"" + rmaNumber + "\" uitype=\"msdyn_rma\" value=\"" + rmaNumberGUID + "\" />" + "</filter>" + "</link-entity>" + "</entity>" + "</fetch>"; let layoutXML = "<grid name=\"resultset\" object=\"10336\" jump=\"msdyn_name\" select=\"1\" icon=\"1\" preview=\"1\">" + "<row name=\"result\" id=\"msdyn_rmaproductid\">" + "<cell name=\"RMAProduct\" width=\"100\" />" + "</row>" + "</grid>"; formContext.getControl('po_customrmaproductfilterid').addCustomView(viewID, entityName, viewDisplayName, fetchXML, layoutXML, true) } }
Any thoughts?