Monday, August 29, 2016

Dynamic CRM - Fetch XML with No Lock


In this post, we will review, how to write a Fetch XML with No lock implemented. This feature will enhance the execution of SQL and will be safer to be run in any environment(s).  Lets review a sample SQL with no lock attribute and will follow with an example on how to using Fetch XML.


SELECT * FROM Employee WITH (NOLOCK);

The above can be implemented using Fetch XML as :

Happy coding...

Dynamic CRM - Fetch XML with NULL operator


In this post, will review how to handle NULL condition within Fetch XML.

As an example, lets review a basic SQL with a NULL condition in WHERE clause and how to execute this statement using Fetch XML.

SELECT EmpId FROM Employee WHERE DeptId = NULL;

Lets review the possibility to execute this SQL using Fetch XML.


Happy Coding....

Dynamic CRM - To retrieve all attributes using Fetch XML in CRM


In this post, will review the Fetch XML script to retrieve all attributes within a given entity.

As an example, lets consider the sample SQL:

SELECT * FROM Employee;

Above SQL, when converted to Fetch XML, will be :

Happy coding....

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....