I'm using the js provided on this blog to display via iframe the Documents tab on the account form. This is working in the web interface, but I get an error in the new UI. Any help would be appreciated.
/// Show Documents subgrid on the main form function setDocumentsIFrame(executionContext, tabName, iframeName) { var formContext = executionContext.getFormContext(); // Hide the tab until we're sure there's something to show var tab = formContext.ui.tabs.get(tabName); if (tab === null) { console.log("Could not find tab: " + tabName); return; } tab.setVisible(false); // Only want to run the code if the record is just being created, otherwise // there will no documents to show anyway if (formContext.ui.getFormType() !== 1) { var iframe = formContext.getControl(iframeName); if (iframe === null) { console.log("Could not find iframe: " + iframeName); return; } var id = formContext.data.entity.getId().replace("{", "").replace("}", ""); // Query SharePoint Documents Locations to find any records which are related to the // record we are currently viewing var req = new XMLHttpRequest(); req.open("GET", formContext.context.getClientUrl() + "/api/data/v8.0/sharepointdocumentlocations?$select=_regardingobjectid_value&$filter=_regardingobjectid_value eq " + id, true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\""); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); if (results.value.length > 0) { // If we have any related items then show the tab and set the IFrame URL accordingly tab.setVisible(true); var url = formContext.context.getClientUrl() + "/userdefined/areas.aspx?formid=ab44efca-df12-432e-a74a-83de61c3f3e9&inlineEdit=1&navItemName=Documents&oId=%7b" + formContext.data.entity.getId().replace("{", "").replace("}", "") + "%7d&oType=" + formContext.context.getQueryStringParameters().etc + "&pagemode=iframe&rof=true&security=852023&tabSet=areaSPDocuments&theme=Outlook15White"; iframe.setSrc(url); } else { tab.setVisible(false); } } else { alert(this.statusText); } } }; req.send(); } }
*This post is locked for comments