Use extended REST functions like contains in Dynamics CRM

醉酒当歌 提交于 2020-01-06 03:01:09

问题


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 Queriesis 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!