Nicholas
Are you using v9? I wrote this off the top of my head so you may have to correct a few things.
function SetDocumentFramev9(context) {
const globalContext = Xrm.Utility.getGlobalContext(),
formContext = context.getFormContext(),
url = `${globalContext.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.getQueryStringParameters().etc}&pagemode=iframe&rof=true&security=852023&tabSet=areaSPDocuments&theme=Outlook15White`
formContext.getControl("IFRAME_???").setSrc(url);
}
Jason documented that "The formid appears to be nothing more than a random guid value and not tied to anything specific in your org.". So try passing a random guid.
------------------------------
Rex Kenley Tan, MCSD: App Builder
Tallmadge OH
https://www.youracclaim.com/users/rex-kenley-tan*Always be CURRENT with JavaScript & C#, NEVER be obsolete.
DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
------------------------------
Original Message:
Sent: Aug 22, 2019 12:08 PM
From: Nicholas Arbour
Subject: Using Script to Display iFrame of Document Associated Grid within the Form
Hello All,
Just wanted to reach out to the community to see if this is something that still works regarding showing the Document Associated Grid within an iFrame in the Form itself without having to navigate to the relationships dropdown menu to select "Documents". Although, this is still how we utilize the function to push the document to SharePoint through Dynamics we want to see a SubGrid/View of some sort directly on the Form without having to having to navigate to the Documents relationship every time. I have included the link below;
https://jlattimer.blogspot.com/2017/01/show-sharepoint-documents-on-main-form.html
I'm not sure if this script would be considered still valid as this was posted in 2017. I'm also fairly certain this isn't OOB obviously so Microsoft will likely not 'support' the feature. However, I have implemented a couple scripts in the past (mainly to grab values from calculated fields and place them within a plain text field for use elsewhere) but this one is giving me a bit of trouble. Unfortunately, I'm not entirely sure where to find the SPDocuments URL for one, and secondly, where to insert that URL into this script to test. I imagine it should go directly under the declaration of this section of the script after Xrm.Page.context.getClientUrl() +;
------------------------------
Nicholas Arbour
TEKLYNX
Whitefish Bay WI
------------------------------