问题描述:

I have two (related) questions:

I am having a puzzling problem with the Advanced Find function. I set up the fields I require, both in the criteria and display section and then hit 'Download Fetchxml'. What I end up with is fields that I never asked for. For example, in my advanced find I asked for All Activities. I changed the results to show me only the Date Created, Activity Type, Subject and Regarding fields. The (truncated) generated fetchXML looks like this:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

<entity name="activitypointer">

<attribute name="activitytypecode" />

<attribute name="subject" />

<attribute name="activityid" />

<attribute name="instancetypecode" />

<attribute name="community" />

<attribute name="createdon" />

<attribute name="regardingobjectid" />

<order attribute="subject" descending="false" />

Why have those extra columns been included? I didn't ask for the 'community' attribute anywhere, for example.

Second question:

What determines the output order of the fields? I ran the above fetchXML through Fetch Tester 3000 (saved my life - thank you!) and the output table bears no relation to the order of the attributes in the xml. This is true also when I use the fetchXML elsewhere.

Thanks in advance for your comments

网友答案:

The FetchXML returned by the button Download Fetch XML is generated internally and in some scenarios it returns extra columns (as you found), for example the primary key field of the entity is always added.

If you remove the additional attributes the FetchXML is still valid and can be executed.

Regarding the order, the tool you used (Fetch Tester 3000) display the fields inside the Table View ordered by their logicalname, inside Dynamics CRM the order of the attributes (subgrids and advanced find results) is defined using another XML definition known as LayoutXML

相关阅读:
Top