Conditions in fetchxml as very straight forward, a full list of them are below.
Example usage for a simple firstname equals robert
<filter type='and'>
<condition attribute='firstname' operator='eq' value='robert'/>
</filter>
Example usage for a simple firstname equals robert or simon
<filter type='or'>
<condition attribute='firstname' operator='eq' value='robert'/>
<condition attribute='firstname' operator='eq' value='simon'/>
</filter>
Example usage firstname is a match to one of the values in a multivalue paramater called @FN (firstname)
<filter type='and'>
<condition attribute='firstname' operator='in' value='@FN'/>
</filter>
Shows any records where the createdon date equals today or within the last 7 days, note: this only looks at the date, so if your looking at a datetime field then no matter what the time is it will show you todays records.
<filter type='or'>
<condition attribute = 'createdon' operator='today'/>
<condition attribute = 'createdon' operator='last-seven-days'/>
</filter>
Condition | Actual comparison | Value |
equals x | eq | x |
does not equal x | ne | x |
is greater than x | gt | x |
is greater than or equal to x | ge | x |
is less than x | lt | x |
is less than or equal to x | le | x |
begins with x | like | x% |
does not begin with x | not-like | x% |
ends with x | like | %x |
does not end with x | not-like | %x |
contains x | like | %x% |
does not contain x | not-like | %x% |
exists | not-null | |
does not exist | null | |
anytime | not-null | |
yesterday | yesterday | |
today | today | |
tomorrow | tomorrow | |
in next 7 days | next-seven-days | |
in last 7 days | last-seven-days | |
next week | next-week | |
last week | last-week | |
this week | this-week | |
this month | this-month | |
last month | last-month | |
next month | next-month | |
this year | this-year | |
next year | next-year | |
last year | last-year | |
on x | on | x |
on or after x | on-or-after | x |
on or before x | on-or-before | x |
in between | between | |
not between | not-between | |
in | in | |
not in | not-in | |
equals user id | eq-userid | |
does not equal user id | ne-userid | |
equals business id | eq-businessid | |
does not equal business id | ne-businessid |