javascript - Dynamics CRM Odata query filter by optionsetvalue - Stack Overflow

How do I filter records by optionset value? I am trying like this:"$select=new_id&$filter=new_

How do I filter records by optionset value? I am trying like this:

 "$select=new_id&$filter=new_campaignid/Id eq guid'" + myId+ "' and new_optionsetfield eq '" + optionsetCode + "'"

But this does not work. I keep on getting bad request with error message:

Operator 'eq' inpatible with operand types 
'Microsoft.Crm.Metadata.ComplexTypeInstance`1[[Microsoft.Xrm.Sdk.OptionSetValue, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]' 
and 'System.String' at position 96.

How do I filter records by optionset value? I am trying like this:

 "$select=new_id&$filter=new_campaignid/Id eq guid'" + myId+ "' and new_optionsetfield eq '" + optionsetCode + "'"

But this does not work. I keep on getting bad request with error message:

Operator 'eq' inpatible with operand types 
'Microsoft.Crm.Metadata.ComplexTypeInstance`1[[Microsoft.Xrm.Sdk.OptionSetValue, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]' 
and 'System.String' at position 96.
Share Improve this question asked Nov 15, 2016 at 18:51 cAMPycAMPy 6072 gold badges10 silver badges28 bronze badges 1
  • after searching for ... unfortunately hours... this question and the answer from @Wedge really saved my day in the end – D M Commented Mar 20, 2020 at 13:45
Add a ment  | 

2 Answers 2

Reset to default 6

I'm pretty sure this is what you need:

"$select=new_id&$filter=new_campaignid/Id eq guid'" + myId+ "' and new_optionsetfield/Value eq " + optionsetCode

Edited: Removed the quotes, because that is an int value, not a string

Here's an exact working sample:

AccountSet?$filter=CustomerTypeCode/Value eq 1

One of my filters for Dynamics CRM 365 (on premise) looks like this

var filter = "(substringof('SomeStringValue', Description) eq false) and (StatusCode/Value ne 1)";

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744845779a4596827.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信