Of Wikipedia’s five definitions of the term “mashup”, my favorite is for what they refer to as a web application hybrid: “a web application that combines data and/or functionality from more than one source”. Here’s the link: http://en.wikipedia.org/wiki/Mashup_(web_application_hybrid).
Dynamics CRM, with its relational database platform and easy customization features, is pretty good for mashups…if what you want to mash up are data stored within Dynamics CRM. In an earlier blog post I discussed how you can integrate Dynamics CRM with SharePoint. There are lots of ways of doing that, but the one I wrote about treated SharePoint content as meta-data associated with a CRM record, and I showed an example of constructing a MOSS search dynamically, and exposing the search results on a CRM Account record’s form using an IFRAME. In a different post I showed a different example of a “CRM mashup”, where you could display, again for a CRM Account record, all of the Linkedin profiles of people associated with that Account.
I wasn’t thinking of those as mashups at the time, but after reading the above definition, they fit the term pretty well! The possibilities are limitless, and since a wide class of them use the same basic CRM customization techniques, you can pound them out pretty quickly after a little practice.
Here’s another CRM mashup, having to do with a web site I’ve been using lately called www.Compete.com. One of the things you can do on Compete.com is enter one or more domain names, and Compete will display a chart with various data about their site traffic. For example, here’s a comparison of live.com and google.com:
(It might be hard to tell from the picture, but Live closed the gap a little bit in January, according to these numbers.) You can do this for up to 5 domains at a time, and this is in the free version. They have a professional version you pay for that does more stuff; I haven’t taken the plunge with that one yet.
From the mashup standpoint, the most interesting thing about this is the URL: http://siteanalytics.compete.com/google.com+live.com/?metric=uv
Since you can access the free version of Compete anonymously, as long as you can construct a URL like this, you can display views like this in any web application where you can expose a page. In SharePoint you can use the Page Viewer Web Part to do it, in Dynamics CRM it’s going to be an IFRAME.
At the same time I was figuring this out I was doing a little research into different CRM blogs and web sites. I was interested in comparing some of the top sites, and seeing things like how much traffic they got, which if any were ad supported, and things like that. So of course, as any self-respecting CRM customizer would do, I whipped up a little custom entity in my CRM Online organization, called it CRMBlogsandSites, and added some custom attributes for the data I wanted to track. Here’s a view of the data grid:

Since I’ve got the URL, I can do my mashup pretty easily. Here’s what one of the forms looks like – I’ll pick on Sonoma Partners in my example:
Notice that I’ve got attributes both for the URL and for the “traffic URL”. I created custom tabs on the form to display the web site, and the traffic chart from compete.com. The Site Traffic tab has an IFRAME on it I called “sitetraffic”. (CRM puts a prefix in front of the name, so in my code I’ll refer to it as “img_sitetraffic”. When a user’s on the form and clicks on the tab, it looks like this:

To create this little mashup, here’s what I did:
1. Created the custom entity I needed, crmblogsandsites, display name “CRM Blogs and Sites”.
2. Added a custom attribute, img_trafficurl (“img” being the customization prefix, so that will most likely be different in your organization, although feel free to use img if you like), display name “Traffic URL”, type nvarchar, length 250, format URL.
3. Opened up the entity’s form in customization mode and added a tab, called it Site Traffic, then added a section to the tab with the same name, but don’t display it. Also, you have to add the trafficurl attribute as a field on the form, don’t forget that!
4. On that section, added an IFRAME. I called it “sitetraffic”, and CRM puts the text IFRAME in front of it, so in code you’ll refer to it as IFRAME_sitetraffic. Notice in the following picture that I’ve unchecked “Restrict cross-frame scripting”. Experiment with it both ways and I believe you’ll find it needs to be unchecked. Also notice the default url I’ve entered. As you’ll see this gets updated in code so it’s not critically important, but using this approach always reminds me of what it’s for, so I’ll often use it.
5. Added this little jscript snippet to the change event of the trafficurl field (remember that one from above?). Remember to check in the box that says “Event is enabled”, otherwise nothing will happen.
crmForm.all.IFRAME_sitetraffic.src = crmForm.all.img_trafficurl.DataValue;
6. Finally, navigate to the Form’s load event (click Form Properties, select OnLoad and click Edit), and add this code:
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
var sitetrafficurl="";
switch (crmForm.FormType)
{
case CRM_FORM_TYPE_CREATE:
// don't need to do anything
break;
case CRM_FORM_TYPE_UPDATE:
if (crmForm.all.img_trafficurl.DataValue != null)
{
// if it's filled in, put value of img_trafficurl field into sitetrafficurl variable
sitetrafficurl = crmForm.all.img_trafficurl.DataValue;
}
break;
}
// Set the IFRAME's URL
crmForm.all.IFRAME_sitetraffic.src = sitetrafficurl;
Make sure the Event is Enabled checkbox is checked, save all your changes and publish your entity and see if it works. This fundamental technique comes up in lots of different contexts, so it might look familiar. The key is to figure out what kind of interesting information is out there on the web, related to an entity you have or can create in Dynamics CRM; then all you need to do is figure out how to construct the URL. And just remember: for any entity you have in Dynamics CRM, there’s probably meta-data for it out there somewhere!
And if you’ve created any good CRM mashups or have an idea for one, let me know.
Cheers — Richard