Fetch Linked Entities SSRS – Microsoft Dynamics CRM Forum Community Forum

0
34
Forum Post: Change the Filter On option on Opportunity Associated View for Account form


I have multiple linked entities in a Fetch XML query.

I used advance filter to pull the xml of the above – without the blue text.  My problem is that I’m not suceeding to insert it correctly, something with the syntax is wrong, but I can’t figure out where.  The error message I get indicates that one of the </link-entity> at the end of the code is incorrect, but I don’t see how.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="account" enableprefiltering="1">
    <attribute name="name" />
    <attribute name="telephone1" />
    <attribute name="new_country_id" />
    <attribute name="new_account_type_id" />
    <attribute name="accountid" />
    <attribute name="new_subcategory11" />
    <attribute name="address1_postalcode" />
    <attribute name="address1_city" />
    <attribute name="address1_name" />
    <order attribute="name" descending="false" />
    <filter type="and">
      <condition attribute="statecode" operator="eq" value="0" />
    </filter>
    <link-entity name="contact" from="contactid" to="primarycontactid" visible="false" link-type="outer" alias="a_410707b195544cd984376608b1802904">
      <attribute name="jobtitle" />
      <attribute name="fullname" />
      <attribute name="emailaddress1" />
      <attribute name="new_profilepicture" />
      <attribute name="new_prefix" />
    </link-entity>
    <link-entity name="new_license" from="new_grower" to="accountid" link-type="inner" alias="ag">
      <attribute name="new_licensestatus" />
      <attribute name="new_grower" />
      <attribute name="new_name" />
      <attribute name="new_licensetype" />
      <attribute name="new_contractvariety" />
      <attribute name="new_totalpaidarea" />
      <attribute name="new_previousentryfeespaid" />
      <attribute name="new_totalentryfeescollected" />
      <filter type="and">
        <condition attribute="statecode" operator="eq" value="0" />
        <condition attribute="new_licensestatus" operator="in">
          <value>100000000</value>
          <value>100000003</value>
          <value>100000005</value>
          <value>100000004</value>
          <value>100000002</value>
          <value>100000001</value>
        </condition>
      </filter>
                                <link-entity name="new_plotinformation" from="new_licensee" to="new_licenseid" link-type="inner" alias="ab" />
                                    <attribute name="new_licensee" />
                                    <attribute name="new_yearplanted" />
                                <attribute name="new_plantationstatus" />
                                <filter type="and">
                                    <condition attribute="statecode" operator="eq" value="0" />
                                </filter>
                                </link-entity>


                                <link-entity name="new_contract" from="new_license" to="new_licenseid" link-type="inner" alias="ah">
                                <attribute name="new_contractstage" />
                                <attribute name="new_signature_date" />
                                <attribute name="new_totallicensedarea" />
                                    <attribute name="new_name" />
                                    <attribute name="new_budget" />
                                    <attribute name="new_creditoffarmtransfer" />
                                    <attribute name="new_payment_per_uom" />
                            <attribute name="new_uom" />
                                    <filter type="and">
                                    <condition attribute="new_contractstatus" operator="in">
                                        <value>100000000</value>
                                        <value>100000001</value>
                                    </condition>
                                    </filter>
                                                        <link-entity name="new_contractline" from="new_contract_id" to="new_contractid" link-type="inner" alias="ai">
                                                    <attribute name="new_variety_id" />
                                                    <attribute name="new_quantity" />
                                                        <filter type="and">
                                                            <condition attribute="statecode" operator="eq" value="0" />
                                                        </filter>
                                                        </link-entity>
                                </link-entity>
</link-entity>
  </entity>
</fetch>



Source link

Leave a reply

Please enter your comment!
Please enter your name here