Skip to content

Instantly share code, notes, and snippets.

@jlattimer
Last active July 7, 2023 15:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jlattimer/f9d897d60c94d17e4dc2e7ac2bbed145 to your computer and use it in GitHub Desktop.
Save jlattimer/f9d897d60c94d17e4dc2e7ac2bbed145 to your computer and use it in GitHub Desktop.
#SharePoint
function SetDocumentFrame() {
//You can see what the url should be by navigating to the 'Documents' area under related records, viewing the page soure
//and looking for 'areaSPDocuments'. The formid appears to be nothing more than a random guid value and not tied to anything
//specific in your org.
//Use: Make sure Document Management is enabled for the entity (helps to turn on automatic folder creation)
// Add a web resource with this code to the form
// Execute this function during the form's OnLoad event
var url = Xrm.Page.context.getClientUrl() +
"/userdefined/areas.aspx?formid=ab44efca-df12-432e-a74a-83de61c3f3e9&inlineEdit=1&navItemName=Documents&oId=%7b" +
Xrm.Page.data.entity.getId().replace("{", "").replace("}", "") + "%7d&oType=" +
Xrm.Page.context.getQueryStringParameters().etc +
"&pagemode=iframe&rof=true&security=852023&tabSet=areaSPDocuments&theme=Outlook15White";
Xrm.Page.getControl("IFRAME_???").setSrc(url); //Replace IFRAME_??? with actual IFRAME name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment