Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM 2016 subgrid layoutxml not working

Posted on by 235

I am adding a subgrid to the form and using javascript to set fetchxml and layoutxml for it. The filter works but the layout doesn't. It always shows the layout of the default view I picked through the form editor.  Here is part of my code. Please help:

var ConnectionSubgrid = document.getElementById("RelatedSeats");
if (ConnectionSubgrid == null) {
setTimeout(function () { FilterConnectionSubgrid(); }, 2000); //if the grid hasn’t loaded run this again
return;
}

var AdmissionSeatFetchXML = '<fetch mapping="logical" count="50" version="1.0"><entity name="ttc_admissionseat"><attribute name="ttc_admissionseatid" /><attribute name="ttc_admissionseatstatus" /><attribute name="ttc_admissionsectionid" /><attribute name="ttc_admissionstatusdate" /> <attribute name="ttc_applicationid" /><attribute name="ttc_candidateid" /><attribute name="ttc_contactid" /><attribute name="ttc_continuingenrollmentid" /><attribute name="ttc_datatelsectionid" /><attribute name="ttc_datatelstatus" /><attribute name="ttc_datatelstatusdate" /><attribute name="ttc_registrarseatstatus" /> <attribute name="ttc_registrarseatstatusdate" /><attribute name="ttc_name" /><filter><condition attribute="statecode" operator="eq" value="0" /><condition attribute="ttc_applicationid" operator="eq" value="' + applicationid + '" /></filter></entity></fetch>';
ConnectionSubgrid.control.SetParameter("fetchXml", AdmissionSeatFetchXML);


var AdmissionSeatLayoutXML = '<grid name="resultset" object="10136" jump="ttc_name" select="1" icon="1" preview="1"> <row name="result" id="ttc_admissionseatid"> <cell name="ttc_admissionsectionid" width="280"/><cell name="ttc_admissionseatstatus" width="120"/> </row></grid>';
ConnectionSubgrid.control.SetParameter("layoutXml", AdmissionSeatLayoutXML);


ConnectionSubgrid.control.Refresh();
Xrm.Page.ui.controls.get("RelatedSeats").refresh();

Thanks.

Holly

*This post is locked for comments

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: CRM 2016 subgrid layoutxml not working

    Aric is correct , as Microsoft introduce turbo form in Dynamics CRM 2015 for faster form rendering and its not supported anymore . So better to develop custom web resource for this type of changes .

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: CRM 2016 subgrid layoutxml not working

    Hi Holly,

    using the setParameter with fetchXml and layoutXml used to work with Dynamics CRM 2015 and above, but Microsoft changed some of the code in 2015 SP1, and this stopped working and/or being supported.

    You will need to find another approach.

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: CRM 2016 subgrid layoutxml not working

    Hello Holly ,

    This is  not a supported approach ,I would recommend create an custom html web resource  and display the data in a  custom grid. There are many free third party grid available like JQuery easy UI , kendo UI . You can  use any of them and  fetch the record to bind the grid .

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans