fetchXML possible to combine or filter on different hierarchy? RRS feed

  • Question

  • hi all, 

    i think about, if its possible to create a filter type=or over linked-entities?

    This is my xml:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="product">
        <attribute name="name" />
        <filter type="and">
          <condition attribute="statecode" operator="ne" value="1" />
          <condition attribute="new_productbez" operator="null" />
          <condition attribute="new_its_product_name_with_manufact" operator="not-null" />
        <link-entity name="new_text_content" from="new_productid" to="productid" alias="aa">
          <filter type="and">
            <condition attribute="new_content_categoryid" operator="eq" uiname="productbez" uitype="new_content_category" value="{AB0ECEC0-9E7E-41D3-B0D5-96510803670D}" />
            <condition attribute="new_content_providerid" operator="in">
              <value uiname="xxx" uitype="new_content_provider">{EE1E1664-139D-4155-969F-A12F53E7A535}</value>
              <value uiname="zzz" uitype="new_content_provider">{B7862C0D-75C5-4781-B5D9-BC98697B7029}</value>
          <link-entity name="new_contenttagxref" from="new_producttextid" to="new_text_contentid" alias="ab">
            <filter type="and">
              <condition attribute="new_contenttypeid" operator="in">
                <value uiname="productbez, short" uitype="new_content_tag">{C5BC6C63-F3B7-4BB3-8F74-3D9805F4C418}</value>
                <value uiname="productdesc, short" uitype="new_content_tag">{FAA2A513-0F1B-4E03-AC2D-E03DEC5C2D81}</value>

    and what i need is to match all products which have

    - a linked entity with uiname="productbez, short" or "productdesc, short"


    - if the attribute "new_its_product_name_with_manufact" direktly in product is not null..

    and this is the whole problem.
    Till now, i only get it working if i create to views

    one for

    - all products which have the attribute "new_its_product_name_with_manufact" (directly in product) isnt null

    and onf for

    - all produts which have a link-entity down to attribute "new_contenttypeid" which have a uiname = "productbez, short" or "productdesc, short" 

    but not combined, because i didnt know how to write the xml for or-condition which have 1 part of the or directly in product und the other part of the or in a subordinated entity.

    any help?


    Thx, Greets PeB

    • Edited by Pe.B Tuesday, March 29, 2016 2:24 PM
    Tuesday, March 29, 2016 2:23 PM

All replies

  • Hello,

    Unfortunately you can't set or conditions in SQL way across several joined entities. Or conditions can be applied only across one entity.

    Dynamics CRM MVP
    Read My blog
    Subscribe for one of my courses

    Tuesday, March 29, 2016 6:05 PM
  • Hi..thx.. is there another way, how i can do it in 1 view? Thx, Gr. PeB
    Wednesday, March 30, 2016 8:51 AM
  • Unfortunately you can't put it in OOB view.

    As possible alternative - you can create HTML/JS webresource that will replicate CRM grid and merge data retrieved from 2 separated FetchXml requests.

    Dynamics CRM MVP
    Read My blog
    Subscribe for one of my courses

    Wednesday, March 30, 2016 9:10 AM