0
votes

I'm looking for a way to access a Dynamics CRM SDK Filter information on a given object.

Ex) Given the field Account.AccountName, I want to know all the possible query conditions that I can execute against this field.

I'm seeing this done inside the XRM Data Tools (see image below)

Could anyone provide sample code on how to do this with the c# dynamics sdk?

enter image description here

1
I think its just hardcoded in the XRM Data Tools. Depending on the attribute metadata it is possible to determine which condition operators are valid. - Henk van Boeijen
That's what I was thinking. Thanks for your help. - TWilly

1 Answers

0
votes

Within C# there are a couple of ways of executing a query using the SDK.

The first is using QueryExpression, which is explained via the link below.

https://msdn.microsoft.com/en-gb/library/gg334688.aspx

You need to look out for the criteria section where there is an ENum of ConditionOperator which will give you all the conditions that you can query against.

https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.query.conditionoperator.aspx

The second is using FetchXML, which can be constructed through Advanced Find and then exported. Performing the query through Advanced Find will allow you to see all the conditional parameters that are available. See link below for executing the FetchXML in C#.

https://msdn.microsoft.com/en-gb/library/gg328117.aspx