Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

fetchXml : retrieve results of 2 fetchXMl in One subgrid

$
0
0

Hello,

I explain my problem to you and hope that someone can help me. Here I have 3 tables in my database

contactssalesordersbeneficiaries 

-contacts and salesorders are connected by a relation Party 1-> N sales orders. The PK is salesorder_id and the FK in salesorders is contactHolder.

- salesorders et beneficiaries are connected by a relation salesorders 1-> N beneficiaries. The PK is not useful but the FK in beneficiaries is b_salesorders_id 

- contacts et beneficiaries are connected by a relation contacts 1-> N beneficiaries. The PK is not useful but the FK in  beneficiaries is b_contacts_id 

I would like retrieve all contacts having  the id value of salesorders but I must verify in the 2 others tables salesorders and beneficiaries . So , if the value that is searched is found in the table benefiaries OR in the table saleorders, we retrieve the contact that will be displayed in a sub-grid?

So I do fetch XML : 

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="contact">
    <attribute name="fullname" />
    <attribute name="telephone1" />
    <attribute name="emailaddress1" />
    <attribute name="address1_city" />
    <attribute name="address1_postalcode" />
    <attribute name="language" />
    <attribute name="contactid" />
    <order attribute="fullname" descending="false" />
    <filter type="and">
      <condition attribute="city" operator="like" value="%brussel%" />
    </filter>
    <link-entity name="salesorders" from="contactholder" to="contactid" alias="ac">
      <filter type="and">
        <condition attribute="salesorders_id" operator="eq" value="1629240001" />
      </filter>
    </link-entity>
    <link-entity name="beneficiaries" from="b_contacts_id " to="contactid" alias="af">
      <filter type="and">
        <condition attribute="b_salesorders_id " operator="eq" value="1629240001"" />
      </filter>
    </link-entity>
  </entity>
</fetch>

I would like to do an OR filter between the link-entity. Is it possible ? Because by default, it is an AND filter.

Is it possible to add the results of 2 fetch XML executions in 1 sub-grid?

Thank you in advance for your answers.

Yours,

Az.


Viewing all articles
Browse latest Browse all 8223

Trending Articles