user6899318
user6899318

Reputation:

Add AND statement to WHERE clause in FETCH XML?

We have this below fetchXML, I have a quick question wondering how I add this and statement to the WHERE clause: and ip.pcssu_quantityavailable >= sod.quantity - sod.quantityshipped to the fetchXML?

<fetch mapping="logical" version="1.0">
  <entity name="SalesOrder">
    <attribute name="ordernumber" />
    <attribute name="statuscode" />
    <attribute name="statuscodename" />
    <attribute name="pcssu_stockavailable" />
    <filter>
      <condition attribute="statuscode" operator="eq" value="141560004" />
    </filter>
    <link-entity name="SalesOrderDetail" from="salesorderid" to="salesorderid" alias="sod" link-type="inner">
      <attribute name="productidname" />
      <attribute name="quantity" />
      <attribute name="quantityshipped" />
      <link-entity name="pcssu_inventoryproduct" from="pcssu_product" to="productid" alias="ip" link-type="inner">
        <attribute name="pcssu_quantityavailable" />
      </link-entity>
    </link-entity>
    <link-entity name="account" from="accountnumber" to="pcssu_servicecentrecode" alias="a" link-type="inner" />
  </entity>
</fetch>

Upvotes: 0

Views: 1438

Answers (1)

Andrew Butenko
Andrew Butenko

Reputation: 5446

I'm afraid that FetchXml doesn't support such syntax. I'm really sorry for that. Also to make your fetch work use your entity names lowercased like salesorder and salesorderdetail (not SalesOrder and SalesOrderDetail).

Upvotes: 1

Related Questions