RSS Feed Power With Salesforce

Tuesday, March 9, 2010 by Aslam - The Alexendra
Hi All,

Here i am again with something interesting thing with Salesforce.

Do you think how it is cool if our Salesforce Organiztion's information will be displayed on variety of Adhoc Web clients. For example I want to display my open cases from my organiztion on iGoogle Home page as a Gadget, my Blackberry or iPhone mobile or My Gmail , Yahoo page or GTalk or Google Reader and so on .... at the same time and same information. Isn't it cool!!!


Yes this is the Power of RSS Feed.


What Is RSS and Why to use it.

RSS was designed to show selected data.

Without RSS, users will have to check your site daily for new updates. This may be too time-consuming for many users. With an RSS feed (RSS is often called a News feed or RSS feed) they can check your site faster using an RSS aggregator (a site or program that gathers and sorts out RSS feeds).

Since RSS data is small and fast-loading, it can easily be used with services like cell phones or PDA's.

Web-rings with similar information can easily share data on their web sites to make them better and more useful.

So, here in this tutorial i am going tell you how you can convert Case Information like your case number with priority and a small Case summary from your Salesforce Organization into RSS Feed and then how you can consume these feeds into your iGoogle/My Yahoo home page or any variety of consumers.

1) Make a contoller with following code (RssFeedController):-

public class RssFeedController{
public List<Case> caseList {get;set;}
public RssFeedController(){
caseList = [SELECT Id, CaseNumber, Subject, Priority from Case];
}
}

2) Make a Visual Force with following code (RssFeedGenerator):-
<apex:page contenttype="text/xml" sidebar="false" showheader="false" controller="RssFeedController">
<rss version="2.0">
<channel>
<title>SFDC Case List</title>
<description>The List gives you all cases open in Your SFDC Org</description>
<link>https://ap1.salesforce.com/500?fcf=00B90000001SEXr</link>
<apex:repeat value="{!caseList}" var="cnt">
<item>
<title>{!cnt.CaseNumber} - {!cnt.Priority}</title>
<description>{!cnt.Subject}</description>
<link>https://ap1.salesforce.com/{!cnt.Id}</link>
</item>
</apex:repeat>
</channel>
</rss>
</apex:page>

3) Enable sites in your organization and add VF page/Contoller to you sites. Also provide read permission on Case object for sites.

4) Now open your sites with our VF page like this:-
http://labsprojects-developer-edition.ap1.force.com/rssfeedgenerator

5) What you see on the page? Your page is converted to a RSS Feed Generator. Isn't it good!!!.
See the above section is for RSS Feed subscribtion area. The below is your feeds.


6) Now you can subscribe this page to variety of Feed Readers like google, yahoo , blogs etc.
For example click on My Yahoo or google from the top dropdown and click on subscribe. It automatically add one Feed Gadgets to your My Yahoo or iGoogle page like below:-



7) Now you can also play with it and add the above rss feed url to any consumer which support RSS Reading like blackberry, iPhone, GTalk, blogs or even your custom RSS Reader for you website.
For Example:-
a. iGoogle





b. My Yahoo


c. GTalk: There are many variety of free available bots which you can add into your gtalk for RSS Feed reading.

d. BlackBerry and iPhone: You can easily consume your rss feeds into your blackberry and iphone

e. Google Reader: Its easy to embed your rss feed into your Google Reader and let the worlds know about it

f. SMS: You can make one Google Channel with your RSS Feed. Then make it SMS enabled and whoever subscribe it , will get notified whenever a new feed comes via SMS.

g. Blog: There are many gadgets which are available for feed reading and you can just plug them into your blog easily into sidebar etc.

h. Website: Of course you can parse your rss feed with any language and add to your website.

So without login or not much code we can view useful information from our salesforce org to any of our client consumers. so, Play with this Good Feature.

Thanks
Aslam Bari

16 comments:

Ritesh said...

Is there any advantage of using a custom page vis a vis the Standard Salesforce Feed feature provided with sites ?

Anonymous said...

I've been trying to create a Rss Feed like you've explained above but for a custom object. I have no problem getting the standard fields to show but the custom fields just wont show up. I have been adding '__c' to denote a custom field but they still will just not show up.

Any ideas?

thanks

Aslam - The Alexendra said...

When you enabling your feeds on Public Sites page, ensure your object and its all fields which you trying to retrieve has proper read permissions. Check the site user FLS for this.

Anonymous said...

This is cool....Good thought.

mayank joshi said...

Awesome Work !!

Sathya said...

Hi,

This is an excellent source of information. Is the vice-versa possible? I need to bring in RSS feed data from an external source and show it up in salesforce? can someone please help in showing how to do it?

myatmyathtwe said...

Hi Aslam,

I'm able to create Rss Feed.
But when it was consuming, I can't see any feed except feed subscription button.
Any suggestion for this?

Thanks.
Myat

Sania Sharma said...

Hi,
Thanks Excellent information....
I have facing some problem in subcription through google reader....SFDC Case List shows in google reader but title unknown occurs, no SFDC List occurs.
Thanks
Sania

Sania Sharma said...

Hi,
http://labsprojects-developer-edition.ap1.force.com/rssfeedgenerator

Above page is publically dispalyed without opened any Salaesforce Account, but my account is not opened like this,Please help me
Thanks
Sania

Aslam - The Alexendra said...

@Sania
You need to make one trigger on account and copy your data into a custom object, and expose that.

Sania Sharma said...

Thanks for a repy,

Sorry need to know,i will create a trigger on Object which i used right? and what i will write on trigger? actualy please expalin it...
Thanks
Sania

Sania Sharma said...

Anyone please help me

why isnt the emails related list available on my case page layout?

Thanks,
sania

increase your conversion said...

Interesting article ! It is important that contents are very organized and the colors used are attractive and not very complex. A user friendly site will surely have more subscribers or followers. Thanks for sharing !

Brian Romanowski said...

What about the test for the controller?

Brian Romanowski said...

In case anyone is looking for the test, it's just a query so you just need to invoke an instance of it.

@isTest
public class RSSFeedTest{
public static testMethod void t1() {
rssFeedController rss = new rssFeedController();
}
}

TRINATH K said...

Please help me for how to display external website links dynamically(google news links) in homepage like Rss feed

Post a Comment