Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Using Script to Display iFrame of Document Associated Grid within the Form

  • 1.  Using Script to Display iFrame of Document Associated Grid within the Form

    SILVER CONTRIBUTOR
    Posted 26 days ago
    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() +;


    Maybe I'm just using the wrong URL? I'm not entirely sure to be honest. If anyone has any additional thoughts, they'd be most welcome.

    Thank you,


    ------------------------------
    Nicholas Arbour
    TEKLYNX
    Whitefish Bay WI
    ------------------------------


  • 2.  RE: Using Script to Display iFrame of Document Associated Grid within the Form

    SILVER CONTRIBUTOR
    Posted 25 days ago
    Hi Nicholas,

    I used this script for a customer on 8.2 online as they really wanted something better than having to navigate to the documents.  I told them it was unsupported and if it stopped working we might not be able to fix it.  When online upgraded it stopped working and they're now without it.

    One of the features you'll see in Unified if you turn the Wave 2 preview on though is a permanent "Files" tab that replaced the need to select Related/Documents.  From that point on, we're closer to the UX that people could reasonable expect from the system.

    Andrew

    ------------------------------
    Andrew Wolfe
    Head of CRM Practice
    Technology Services Group
    United Kingdom
    ------------------------------



  • 3.  RE: Using Script to Display iFrame of Document Associated Grid within the Form

    TOP CONTRIBUTOR
    Posted 25 days ago
    @Nicholas Arbour - The upcoming October 2019 could make this a moot point. I have been testing the early release and noticed that with the SharePoint integration enabled there is a new "Files" tab automatically set on the entity. I have noticed that the "upload" option is not available. But, there is a button called "see associated records" that will open the "classic" "Documents" grid.





    ------------------------------
    Aaron Back, MCSE
    Sr. Microsoft Dynamics 365 Consultant
    ACE Microtechnology
    _______________________________________
    CRMUG Board Member
    CRMUG Chapter Leader - Cincinnati, Ohio
    ------------------------------



  • 4.  RE: Using Script to Display iFrame of Document Associated Grid within the Form

    SILVER CONTRIBUTOR
    Posted 12 days ago
    Hello All,

    Thank you for the updates and information. Have been away and forgotten to check this, as we've been building a new POC. But, I can definitely try a few things here from what you've stated. If this indeed will be a 'thing' in the new UI come October, I may wait until then to test this out. Otherwise, if necessary, it looks like I have a few options. Thank you again.

    ------------------------------
    Nicholas Arbour
    TEKLYNX
    Whitefish Bay WI
    ------------------------------



  • 5.  RE: Using Script to Display iFrame of Document Associated Grid within the Form

    TOP CONTRIBUTOR
    Posted 22 days ago
    Edited by Rex Kenley Tan 22 days ago
    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) {

    //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

    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.
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role