问题
I'm making a subgrid on account to show all related contacts by multiple fields. Here's fetch xml I'm trying to set:
<fetch mapping="logical">
<entity name="contact">
<attribute name="firstname" />
<filter type="or">
<condition attribute="new_behorde" operator="eq" value="" />
<condition attribute="new_behorde2" operator="eq" value="" />
<condition attribute="new_behorde3" operator="eq" value="" />
</filter>
</entity>
I'm setting this using document.getElementById("contacts").control.SetParameter method. But if I try to run document.getElementById("contacts").control.refresh(), effective fetch xml becomes:
<fetch mapping="logical">
<entity name="contact">
<attribute name="firstname" />
<filter type="and">
<condition attribute="new_behorde" operator="eq" value="" />
<filter type="or">
<condition attribute="new_behorde" operator="eq" value="" />
<condition attribute="new_behorde2" operator="eq" value="" />
<condition attribute="new_behorde3" operator="eq" value="" />
</filter>
</filter>
</entity>
This happens because I chose new_behorde as related field in the subgrid.
So can I somehow avoid adding this extra filter and extra condition?
回答1:
When setting up your subgrid in the form editor, select that you want to return all records, not just the ones related to this entity. Then CRM will leave your FetchXml alone.
来源:https://stackoverflow.com/questions/36944480/dynamics-crm-fully-custom-fetchxml-in-subgrid