locked
Parsing string in to FilterExpression to asign to QueryExpression.Criteria RRS feed

  • Question

  • HI Friends,

          I have a requirement where I get string as condition  to my method and I have to parse it and  build Filter expression's to retrieve records

    What is the best way to achieve this?


    Thanks Regards Prashanth Kamasamudram Even the least work done for others awakens the power within; even thinking the least good of others gradually instills into the heart the strength of a lion.

    Thursday, January 23, 2014 6:40 AM

All replies

  • It depends on what the string is really. If it's just a string of text you may have to parse it and build up the Filter Expression manually.

    Can you give us an example string you would receive?

    Thursday, January 23, 2014 10:36 AM
  • Well it will be something like  "statecode= 'Active'  AND firstname ='suresh' "  it may be more complex .   So there is no option in CRM which can take condition in string format?

      In that case we may need to change condition format to  identify attribute names and values and condition operators. 


    Thanks Regards Prashanth Kamasamudram Even the least work done for others awakens the power within; even thinking the least good of others gradually instills into the heart the strength of a lion.


    Thursday, January 23, 2014 10:55 AM
  • There is, in the form of XML. Basically, you'd need to conform with its XML format in text form and deserialize it into an object. If you're going down this route then it might be better to look into FetchExpressions, because that might work better for you.

    I guess it depends on what your architecture is like around these objects. It's hard to say which way is better to do it in your case.



    Thursday, January 23, 2014 11:44 AM