Your Force.com site is up and running, and you'd like to add a feed that shows
your users up to the last 20 accounts added to your Salesforce.com organization.
Define a feed and add it to a Visualforce page in your site. Users can then click an icon to subscribe to
Before you start, make sure that Sites are
enabled and that you have set up a site as described in the Salesforce.com online
help, including setting the public access settings and enabling feeds
for your site.
To create a feed and add it to a Visualforce page in your site:
- Click Setup | Develop | Sites to display the list of
sites created for your organization.
- Click the name of the site where you want to add a feed. Click
the Site Label link, not the Site URL link.
- In the Syndication Feeds detail area, click New and enter the following values:
- Name: LatestAccounts
- Description: Up to the last 20
accounts added to our organization.
- Query: SELECT Name from Account
- Mapping ft: "test", fa:"Mysti",
- Max Cache Age Seconds: 600
- Click Save, then click Back
to Site Detail to return to the sites detail page.
- Click Preview next to LatestAccounts to test the feed to ensure it delivers the information you expect.
The preview page displays what the feed will display to users, and
provides a link to the site where the feed will be displayed.
- After the feed is created and tested, add a link to the feed in
your Visualforce page by adding the following markup:
<A HREF="/xml/services/LatestAccounts">Latest Accounts</A>
The path assumes your page is located in the base directory of
the site. You may have to adjust the path if it is not.
- Now users who visit the page can click the link Latest
Accounts and subscribe to the feed.
The feed created here is very
simple. You can write much more complex SOQL queries for the feed
to tailor the information for your users. For example, the following
query would report up the last five accounts created later than yesterday:
SELECT Name from Account where CreatedDate < Yesterday LIMIT 5
The SOQL query defines what information is collected, but the
mapping determines what information is displayed in the feed itself,
using elements of the ATOM protocol. For an explanation of the elements,
see “Defining Syndication Feeds” in the Salesforce.com online
help. This topic also explains some of the limitations placed on SOQL
for feeds queries. These limits are in place to ensure good performance.
It's important that you set public access settings for objects
properly. Because the feed issues queries as the site guest user,
you must assign the correct public access settings to the profile
for that guest user, or queries may return either not enough information
or information about objects that you don't wish to share with the
guest user.Similarly, you must set sharing rules appropriately. Instructions
for setting the public access settings and sharing rules are provided
in the Salesforce.com online help.
Feeds support the use of bind variables
in both the query definition and mapping. At run time, the value of
the bind variable is passed in the URL. More information about bind
variables is provided in the Salesforce.com online