Chapter 3. An Introduction to Development with Chatter

In the previous chapters, we learned what Chatter is, and how to configure Chatter for your organization. We also discussed how to create groups, add/remove a member from a group, invite your customers to Salesforce Chatter, manage files, update status, feed tracking, and so on. We also learned how to set up an e-mail for Chatter newsletters and publisher actions. In this chapter, we will discuss how to use Chatter with the Visualforce page, and later on we will go through some Chatter recipes such as how to turn a group into a notice board and so on. In this chapter, we will cover the following topics:

  • Displaying a chat window on the Visualforce page
  • Displaying a Chatter follower on the Visualforce Page
  • Displaying a user's profile image
  • Displaying a list of followers for a user
  • Displaying news feed
  • Posting status from the Visualforce page
  • Entity feed and how to display it on the Visualforce page
  • Automatically following a record after its creation
  • Automatically following a group
  • Applying filters on group creation
  • Applying filters on the Chatter post
  • Applying filters on comments on a Chatter post
  • Filtering a post for some records
  • Posting opportunity-closed details to a Chatter group
  • Making a group that allows read-only access

To customize the functionality of Chatter, we can use Salesforce Apex and Visualforce pages as per our needs. Here we will discuss few sections of Chatter in detail.

Starting with Apex and Visualforce coding, it's recommended to create a developer account. Once the developer account is active, navigate to the user record by following the path Name | Profile | User to enable the development mode. You can enable it to create a Visualforce page by entering a name in the URL (/apex/Your_PageName).

Note

In this chapter, we have provided example code snippets. However, the complete code can be downloaded from www.packtpub.com/support.

Displaying a chat window on the Visualforce page

A chat window is a box where you can chat with your followers in real time; it will send/receive your message immediately. To display the chat window in the Visualforce page, we have the following two ways.

Enabling chat settings for all Visualforce pages

Follow the given steps:

  1. Navigate to Name | Setup | App Setup | Customize | Chatter | Chat Setting | Edit.
  2. Then check on the Allow checkbox under Visualforce Settings, as shown in the following screenshot:
    Enabling chat settings for all Visualforce pages
  3. Once it is enabled, the chat window will appear with all Visualforce pages.

To display the chat window on selected Visualforce pages, go ahead with the following method.

Enabling chat settings for a particular Visualforce page

To enable chat settings for a particular Visualforce page, perform the following steps:

  1. Create a Visualforce page (by appending /apex/PageName after https://InstanceName.salesforce.com), and add a Showchat="true" attribute under the <apex:page> tag as shown in the following code:
    <apex:page showChat="true"/>
  2. Click on the arrow mark within the red box to enlarge the Chat window, as shown in the following screenshot:
    Enabling chat settings for a particular Visualforce page
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.75.10