问题
As I noticed, fetching data in Dynamics CRM with REST is a lot faster then with SOAP especially for big data.
Since I'm new to this topic (REST) I want to ask if it's necessary to include any additional library to use functions in my query for instance "contains".
If I send the query:
XrmServiceToolkit.Rest.RetrieveMultiple("ActivityPointerSet",
"$filter=contains(Subject,'Test')&$top=10",
function(results){
console.log(results);
},
function(error){
console.log(error);
},
function onComplete(){
}, false);
I get the error message: Error : 400: Bad Request: Unknown function 'contains' at position 0.
I got more or less intricate queries yet with fetchXML. Is it in most cases possible to alter them to REST?
Best Regards
回答1:
You cannot use the C# QueryExpression
functions in Odata Queries
directly. You have to modify them according to Odata Syntax/Functions
.
Please change your query to below and try again:
select=*&$filter=substringof('Test',Subject)&$top=10
A very good tool to generate complex Odata Queries
is
Dynamics XRM Tools
Adding Selection Criteria to REST Queries in CRM 2011
来源:https://stackoverflow.com/questions/36933403/use-extended-rest-functions-like-contains-in-dynamics-crm