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

    GOLD CONTRIBUTOR
    Posted Aug 22, 2019 12:08 PM
    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
    ------------------------------
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    SILVER CONTRIBUTOR
    Posted Aug 23, 2019 04:14 AM
    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
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    MICROSOFT MVP
    Posted Aug 23, 2019 08:29 AM
    @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
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    GOLD CONTRIBUTOR
    Posted Sep 05, 2019 12:45 PM
    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
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    Posted Apr 30, 2020 03:07 PM
    Edited by Sumit Choudhary Apr 30, 2020 03:12 PM
    Hello Everyone
    I was also wondering how to add document locations on a custom entity, I didn't find any content on google. So, I have tried to add a related document tab from power apps form designer and able to find the solution. you could also try it.
    *Power apps form designer can be open from the app designer from your model-driven app.
    Power apps form designer can be open from the app designer from your model driven app


    If you face any issue you can connect with me on sumitmx0850@outlook.com

    ------------------------------
    Sumit Choudhary
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    TOP CONTRIBUTOR
    Posted Aug 26, 2019 07:58 AM
    Edited by Rex Kenley Tan Dec 06, 2019 09:23 AM
    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.
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    TOP CONTRIBUTOR
    Posted Dec 05, 2019 05:53 PM
    Hi @Rex Kenley Tan,

    I find myself doing the same thing. While I have the iFrame showing the document grids, I am not entirely clear on options to change the formatting. The URL contains a number of parameters, as shown below, but I can't find any documentation for them.

    https://auricsandbox.crm.dynamics.com/userdefined/areas.aspx?
    formid=ab44efca-df12-432e-a74a-83de61c3f3e9
    &inlineEdit=0
    &navItemName=Documents
    &oId=%7b70183B06-9C53-E811-8108-E0071B7E8CC1%7d
    &oType=10019&pagemode=iframe
    &rof=true
    &security=852023
    &tabSet=areaSPDocuments
    &theme=Outlook15White

    ​​The inlineEdit parameter=0 will cause the main header to disappear, which helps reduce the layout size... Do you know what the other parameters are / if there are any others than can be used to edit the layout / where this might be documented more thoroughly? I'm looking to make it fit in a narrow column.


    ------------------------------
    Ryan Perry
    Business Systems Analyst
    Auric Solar
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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

    TOP CONTRIBUTOR
    Posted Dec 06, 2019 10:16 AM
    @Ryan Perry

    Unfortunately it's a nay on the documentation. :(

    The closest thing that I could find is a very old blog post.
    http://mscrmshop.blogspot.com/2013/01/step-by-step-tutorial-to-add-missing.html



    ------------------------------
    Rex Kenley Tan, MCSA, MCSD
    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.
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


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