Sunday 18 September 2011

Construct FetchXml queries the easy way

We all are lazy, I mean, we all like to minimize energy output and what better way of doing that than letting others do the work for you.

An easy way of creating a FetchXml query is to use Advanced Find. (http://<hostname>/ORG/AdvancedFind/AdvFind.aspx)
  1. Create the query that you wish to use. Bear in mind that some attributes might be missing, you can always add them later manually to your code.
  2. Run Query, i.e. Press Find
  3. Type the following in the address bar:   javascript:prompt("q:", resultRender.FetchXml.value);
  4. Hit Enter
  5. You'll get a window with the query used. Grab it and use it in your code.
If you don't have an address bar, in step 3, just hit Ctrl + N.

Luckily, Microsoft has recognised the productivity gains that this (easily generated FetchXml queries) can generate and has included a button to do this in Dynamics CRM 2011.

No comments:

Post a Comment