condition element

Specify conditions for entity and link-entity row values which must be true to return the row. The condition operator attribute specifies how to evaluate the values.

Learn how to filter rows using FetchXml.

Example

This query returns account records where address1_city equals 'Redmond'.

<fetch>
  <entity name='account'>
    <attribute name='name' />
    <filter type='and'>
      <condition attribute='address1_city'
        operator='eq'
        value='Redmond' />
    </filter>
  </entity>
</fetch>

Attributes

Name Required? Description
attribute No The name of the column with the value to apply the filter.
entityname No Specify the link-entity name or alias that the condition should be applied to after the outer join. Learn more about filters on link-entity
operator Yes The operator to apply with the filter.
value No The value to test the column value with the operator.
valueof No The name of the column in the same table that has the value to test the column value with the operator. Learn more about filtering on other column values.

Parent elements

Name Description
filter Specify complex conditions for an entity or link-entity to apply to a query.

Child elements

Name Occurrences Description
value 0 or Many Specify values for operators that require multiple values.

Remarks

  • Use the value attribute for all operators that compare to a single value. For example, eq.
  • Use the value element for operators that compare to multiple values For example: in.
  • Some operators require neither the value attribute or the value element. For example: null.