In Salesforce Chatter you can follow records and Chatter Groups. In this post I will talk about only record. You can follow any record by navigating to records detail page and clicking on follow button as shown in below screen shot
If you want to Automatically follow records that you create, to do that follow the below instruction
- Click on Name | My Settings | Chatter | My Feeds
- Select Automatically follow records that I create check-box as shown in below image
Business Use case :- In Universal Container higher management want a way to auto select Automatically follow records that I create check-box as soon as user record get created in Salesforce. Now every user has to select it manually, Because of this check-box is not selected user won’t get any information about record on their Chatter Feeds.
Solutions Method 1
Automatically follow records that I create check-box field on user record API name isUserPreferencesEnableAutoSubForFeed, so you can write a trigger on user object and set true to this flag, you can take help from below code and modify it accordingly
Trigger autoselectfollowrecord on User (before insert, before update) {
for(user user: Trigger.new)
{
user.UserPreferencesEnableAutoSubForFeeds = true;
}
}
for(user user: Trigger.new)
{
user.UserPreferencesEnableAutoSubForFeeds = true;
}
}
Solutions Method 2
You can also use Visual workflow (Flow) to set this field true, and use workflow rule to fire flow, Because we can’t set this flag true from workflow field update. In this solution i will not use any single piece of apex code. To do this for your organization follow the below steps
- Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
- Click on New Flow, it will open flow canvas for you
- Drag and Drop Record Lookup onto canvas, and set Entry criteria Last Name ! = Null by selectingglobal constant from drop down, on update field value select fieldUserPreferencesEnableAutoSubForFeed and set it true by select global constant true from drop down as shown in below Image
- Now create a button to call flow as ( New workflow action called a flow trigger, which launches a flow when the workflow rule criteria are met. We can use after Spring’14 release, to use it your Salesforce administrator will have to request Salesforce.com as it’s under Pilot program). Button on case will look like below screen shot
Add this custom link on User page layout
It’s time to test this feature
First deselect Automatically follow records that I create check-box and go to the your user record’s detail page and click on custom link and see the magic, as shown in below image
Note:- You can remove button and write a workflow with condition then it will fire flow action, when Last Name Not null. You can do all this after Spring’14 release, your administrator have to request to Salesforce to enable feature fire flow from workflow rule.
Post a Comment