Our team has just finished integrating Dynamics CRM with Bing maps to enable users to perform interactive queries to list all contacts in certain area. The tool is very quick and easy to use. One of most important components is enabling users to reuse saved queries from CRM, so users can predefine not only the geographical area, but build more complex queries and put them onto the map.
Here’s a couple of notes which will be helpful for FetchXml to be executed properly:
1. CRM has three different system entities for saving predefined queries, which actually do the same function but are in fact separate:
a. savedquery – (called View in CRM)
b. filtertemplate (Filter Template in CRM)
c. userquery (called Saved View in CRM) – this one suits us and contains advanced filter views only, not system or other views.
2. The user can select any range of fields, so it makes sense to check for specific fields which are useful for us but are not present in the query, e.g. a phone number or physical address if you build a map application.
3. Basically FetchXml is simple enough XML, so standard .NET classes will be enough to inject parameters into the query:
4. Advanced find views are owned by a user, so you need to make sure SDK is impersonated with a correct account or the advanced view is shared with the account. For example by making plugin which will share records automatically.
5. After, you’ll get response XML and all what you need to do is to parse it properly which is easily.
This feature will make your custom pages more flexible and more deeply integrated with minimal effort. The user will like that.