November 20, 2014

ConditionOperator To FetchXml Operator

Dynamics CRM SDK contains the ConditionOperator enumerator that can be used when building a QueryExpression, but the SDK doesn't provide a way to convert a ConditionOperator to its FetchXml equivalent.

I created a static method that accepts a ConditionOperator enumerator and returns a string containing the equivalent FetchXml operator:

public static string ConditionOperatorToFetchXmlOperator(ConditionOperator conditionOperator)

string fetchXmlOperator = ConditionOperatorToFetchXmlOperator(ConditionOperator.EqualUserId); 
// fetchXmlOperator will be "eq-userid"
The library can be downloaded from Technet Gallery:
https://gallery.technet.microsoft.com/scriptcenter/ConditionOperator-To-065c445e

Note: the library contains the ConditionOperator for CRM 2011, CRM 2013 and CRM 2015.

0 comments:

Post a Comment