Monday, August 29, 2016

Dyanmic CRM - Retrieve multiple values with IN operator in Fetch XML.


In this post, will review the need for multiple values in IN operator and how to execute them.

In plain SQL, it is pretty simple and easy to handle IN operator with multiple values, but doing in Fetch XML can be simple too, with few extra steps. I will list two different options to achieve the results.

First, lets review the plain SQL, that needs to be converted.

SELECT EmployeeId, EmployeeName FROM Employee WHERE DeptId IN(1,2,3,4,5). 

Now lets see, how we can implement the same with Fetch XML. First option will be to hard code the values of IN operator.





Now lets review, the other option to include multiple values within the condition for IN operator.

I hope this provides some insight into using IN operator within Fetch XML.

Happy coding....

No comments:

Post a Comment