1

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

Patrik
  • 1,119
  • 5
  • 18
  • 37
  • 1
    Dynamics CRM only supports a limited subset of the OData specification. Take a look at the CRM SDK or the documentation on MSDN. Dynamics CRM 2016 introduces Web API and a more complete implementation of OData v4. – Henk van Boeijen Apr 29 '16 at 12:40
  • For reference, here's the 2011 SDK's page on the operators: https://msdn.microsoft.com/en-us/library/gg309461(v=crm.5).aspx – Polshgiant May 02 '16 at 14:11

1 Answers1

6

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 Queriesis Dynamics XRM Tools

enter image description here Adding Selection Criteria to REST Queries in CRM 2011

Dot_NET Pro
  • 2,095
  • 2
  • 21
  • 38