Microsoft Dynamics CRM 4.0 - Thought Repository

Tuesday, April 28, 2009

Stream Contextual News Headlines to CRM Accounts

View Comments


Dynamics CRM 4.0 Account with Google News widget
Experimental Feature: This feature is more of a proof of concept and is not ready for production environments.
A good practice of CRM is to keep up to date with news on your customers which can lead to interesting talking points. I thought it would be useful to create a context sensitive Iframe for Leads or Accounts, which would pull in the latest headlines based on the name of a customer. Now, this would only work for bigger, more well known customers, as their names are more likely to show up in the news.


I started off by looking for the RSS feeds of prominent news organizations including Reuters and Bloomberg, hoping to create contextual filters by using Yahoo Pipes. Haplessly, I found out that Bloomberg discontinued their RSS feed some time in late 2006. While looking at the Reuters feed API, I realized pulling RSS feeds from individual sites wasn't enough, what I really needed was a news aggregator. I came across Google News, which turned out to be exactly what I needed. Google News aggregates content from thousands of sources, distills similar articles and gives the ability to sort by article publication date. Checking the Google News documentation revealed that a Google News widget was released in February 2009. I decided to take this widget for a spin.

The code below was modified from the widget sample code to grab the name of an Account as the query parameter.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google News</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
 google.load("elements", "1", {packages : ["newsshow"]});
 var newsTopic = window.parent.crmForm.all.name.value;   //get name of account from parent frame
 function onLoad() {
   // Change the topic to business
   var options = {
     "queryList" : [
       {
  "title" : newsTopic,  //title of news box
  "q" : newsTopic,      //query parameters
  "scoring" : "d",      //order results by date
  "rsz" : "large",      //return large result set (8 entries max) 
  "ned" : "us"       //limit results to US
       }
     ],
     "linkTarget" : "_blank"
   }
   var content = document.getElementById('content');
   var newsShow = new google.elements.NewsShow(content, options);
 }

 google.setOnLoadCallback(onLoad);
</script>
  </head>
  <body style="font-family: Arial;border: 0 none; background-color: #EAF3FF">
    <div id="content"></div>
  </body>
</html>
Save this code into a file named GoogleNews.html and place it into "C:Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\News" the ISV folder of your CRM 4.0 on premise install. By default, a 'News' folder does not exist so please create one.

Next, go to Settings->Customizations->Customize Entities->Account->Form and add an Iframe onto the page. Give it the name and settings as shown below.

Settings for adding Google News Iframe

Publish the changes to Account and you should begin to see news items stream on Account pages.

Unfortunately during my testing I found some flaws in this approach for pulling in news, namely:
  • The news results sometimes displayed information unrelated to the Account. An Account named "American Airlines" would return results with both "American" and "Airlines" which does not necessarily relate the Account name.
  • News results are limited to 8 stories
  • News would sometimes show up in foreign languages, even with the parameter set for only US stories.

Google News showing foreign language content

The Google News widget definitely has potential but for now it is not ready for production environments.

On a related note, I noticed that the Google Finance pages tend to to use some other algorithm to determine the relevancy of an article to a company and as a result have more accurate articles. Now if there was some way to pull in the news stream from the Google Finance pages, I'd be the first one to sign up.

Google Finance with ideal account News

blog comments powered by Disqus

About Me

Henry Bow
I'm a programmer living in sunny Orange Country, California. Since the beginning of 2008, I've been developing on the MS Dynamics CRM 4.0 platform. This blog will help me jot down some of the tips and neat features I've developed along the way while giving me a chance to dabble into the curious world of analytics and SEO.

Please let me know if I can help with your CRM needs.
hbow27@gmail.com

Feed Rss

Subscribe to new posts via e-mail

Recent Posts