new Fetch(entityName, attr, filterConditions)
Default Constructor
Parameters:
Name | Type | Description |
---|---|---|
entityName |
string | Optional. Name of the entity which the query is for |
attr |
string | boolean | Array.<string> | Optional. Either a column name, or a list of column names, or a boolean value indicating that all the attribute values want to be retrieved. The default value is null, and means that only the primary attribute will be retrieved. |
filterConditions |
object | Optional. Object that describes conditions in an JSON notation. More Info: Fetch#setFilter |
Examples
var fetch = new Fetch(); console.log(fetch.toString()); // outputs: <fetch><entity></entity></fetch>
var fetch = new Fetch("account",["description","createdon","ownerid"],{name:"acme"});
var fetch = new Fetch("account",true,{name:"acme"});
Methods
-
setFilter(filterCondition)
-
Sets the filter criteria of the current FetchXml with the specified values.
The specified value can be eiher a Filter object or a conditions object.
A conditions object is a Javascript object where every property represents a condition.
If the object contains a property, and that property contains a simple value, like an string or a number, that means property equals to value.
If you need to specify another operator, then you have to use the form: {attribute:{$operator:value}}
If the value is an array, then the $in operator is used.
If the value is a null value, then the nulloperator is applied. For example: {name:null} will retrieve all the records where the name is null.
Parameters:
Name Type Description filterCondition
Filter | object A Filter object or a Conditions specified in JSON notation.
- Source:
- See:
-
- Build queries with FetchXML: https://msdn.microsoft.com/en-us/library/gg328332.aspx
Examples
var cond = {name:"myAccount"};
var cond = {name:"myAccount", createdon:new Date()}
var cond = {name:{$like:"contoso%"}, createdon:{$bt:new Date()}}
$eq, $neq, $gt, $ge, $le, $lt, $like, $notlLike, $in, $notIn, $between, $notBetween
var cond = {name:["contoso", "acme", "cycleworks"]};
var cond = {name:null};
var cond = {name:"$notNull"};