Sub-Grids populated with custom FetchXML using JScript do not render correct data in Outlook Client or Print Preview form
-
Thursday, April 12, 2012 4:57 PM
Many of my form sub-grids utilize JScript web resources to fetch aggregate data from multiple, related entities. However, it doesn't appear as if Dynamics 2011 propagates those scripts to the Print Preview form or the Outlook client. The sub-grids on the Print Preview form and Outlook client page display data based on the filter definition of the view used in that particular sub-grid, NOT the custom data.
See screenshots attached to replies. On the first screenshot the 2 sub-grids display the correctly filtered data - 7 records and 0 records accordingly. The second screenshot is of the Print Preview form where the 2 sub-grids simply display ALL the data - the same thing occurs when viewing the record in the Outlook client.
Hopefully this occurs by design and there is a simple solution I’m unaware of. If not, this is a significant issue with Dynamics that could dramatically impact my company’s planned rollout because of the sheer importance of the data displayed.
Any help would be greatly appreciated.
Dave
All Replies
-
Thursday, April 12, 2012 5:33 PM
-
Thursday, April 12, 2012 5:33 PM
-
Friday, April 13, 2012 6:57 PM
Apparently I didn't think this through completely. If a form calls a JS web resource OnLoad (see script below) in order to fetch a custom dataset that will populate a sub-grid, there's no way (out of the box) another form (like the Print Preview .aspx form) would use it too; much less Outlook client.
However, this creates a considerable amount of rework to be done and anyone using custom fetch scripts for this purpose (and many are) should beware of this ;-)
Happy Friday!
Dave
function GetAllPrimaryAssignsForParticipant(context) { var sgrid = "AllPrimaryAssignments"; //Get CRM record info var thisRecordId = Xrm.Page.data.entity.attributes.get("ok_pfinvestigation").getValue(); var fetchXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">' + '<entity name="new_assignment">' + '<attribute name="new_assignmentid" />' + '<attribute name="new_caseid" />' + '<attribute name="new_startdate" />' + '<attribute name="new_enddate" />' + '<attribute name="new_unitid" />' + '<order attribute="new_unitid" descending="false" />' + '<order attribute="new_enddate" descending="false" />' + '<filter type="and">' + '<condition attribute="new_rolecode" operator="eq" value="1" />' + '</filter>' + '<link-entity name="new_fscase" from="new_fscaseid" to="new_caseid" alias="aa">' + '<attribute name="new_caseid" />' + '<attribute name="new_casestatus" />' + '<link-entity name="ok_fscaseparticipation" from="ok_fscase" to="new_fscaseid" alias="ac">' + '<link-entity name="ok_person" from="ok_personid" to="ok_participant" alias="ad">' + '<link-entity name="ok_investigationparticipant" from="ok_participant" to="ok_personid" alias="ah">' + '<filter type="and">' + '<condition attribute="ok_investigationidforreference" operator="eq" value="' + thisRecordId + '" />' + '</filter>' + '</link-entity>' + '</link-entity>' + '</link-entity>' + '</link-entity>' + '</entity>' + '</fetch>'; updateXmlAllPrimaryAssignments(sgrid, fetchXml); } function updateXmlAllPrimaryAssignments(grid, xmlfield) { try { var g = document.getElementById(grid).control; g.setParameter("fetchXml", xmlfield); } catch (e) { } // Refresh the grid document.getElementById(grid).control.refresh(); };

