0

I want to retrieve all attributes of entity but exclude some of them. Like if entity have 42 attributes I want to exclude Name, Date and retrieve all others. Below is what i have tried.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
    <entity name="account" >
        <all-attributes/>
        !<attribute name="name" />!
        <order attribute="statecode" descending="false" />
        <filter type="and" >
            <condition attribute="statecode" operator="eq" value="0" />
            <condition attribute="location" operator="eq"  uitype="location" value="{11c43ee8-b9d3-4e51-b73f-bd9dda66e29c}" />
        </filter>
    </entity>
</fetch>
Aaditya
  • 43
  • 6

1 Answers1

0

You should remove <all-attributes/> node and add all the attributes you want into the fetchXML. The fetchXml should look like:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
    <entity name="account" >        
        <attribute name="a"/>
        <attribute name="b"/>
        <attribute name="c"/>
        <attribute name="d"/>
        <order attribute="statecode" descending="false" />
        <filter type="and" >
            <condition attribute="statecode" operator="eq" value="0" />
            <condition attribute="location" operator="eq"  uitype="location" value="{11c43ee8-b9d3-4e51-b73f-bd9dda66e29c}" />
        </filter>
    </entity>
</fetch>

Here are some ways to generate a fetchXml:

  1. Download from Advance find. You can download the fetchXml after you added the columns and conditions you want.enter image description here
  2. Use the FetchXML Builder.
  3. Use Dataverse REST Builder
ray gan
  • 98
  • 10