Display any FetchXML in an iFrame

June 1, 2010 by Geron Profet · 9 Comments 

This article describes how you can display any FetchXML in an iFrame in MS CRM. The idea is to create a complete request using the advanced find window and extract the FetchXml , LayoutXml and DefaultQueryId. For more information on how to display Fetch in an iFrame see the original post by Adi Katz: Display Fetch in IFRAME – Part 2.

Instructions:
    To determine the exact fetchxml and fetchlayout follow this procedure(thanks to Ronald Lemmen):
    1. Go to adv. find and press F11 to get the address bar.
    2. Create the query and layout
    3. In address bar paste this line of code: 

 javascript:void( new function(){ prompt("Fetch Parameters:",getFetchParams());function getFetchParams(){ return "FetchXml:\n" + advFind.FetchXml + "\n\n" + "LayoutXml:\n" + advFind.LayoutXml + "\n\n" + "EntityName:\n" + advFind.EntityName + "\n\n" + "DefaultAdvancedFindViewId:\n" + advFind.DefaultAdvancedFindViewId } } ) 

    4. Click Enter, all parameters are now in your clipboard and can be pasted in your code.
    5. Copy the code in the Onload event and call the function using one of the examples below: Read more