Post to Chatter by sending an email



After Spring’14 release you can be able to post in  Chatter Group Directly from your mail inbox. It’s doesn’t require your Salesforce credentials. You can can only email your posts to Chatter groups that you have access to. So what about Post to Chatter by sending an email feature. Salesforce doesn’t have any out-of-box features for this. In this article I will show you how you can easily develop this app for your organization without writing a single line of code.
Business Use case :- Higher management in Universal Container wants a way to post to chatter by sending an email.
Solution of above business requirement
To solve above business requirement I will use Email-to-caseVisual workflow and Flow Trigger. I will not use a single line of apex code.  It’s very easy to implement, any Salesforce admin also can implement this for their organization. I will first configure email-to-case then I will use Visual workflow and Flow Trigger to create Chatter Post. Before proceeding you have to understand FeedItem objects in Salesforce.  For text post we need these three values
1) Body :- This is the message that appears in the feed.
2) ParentId :- ID of the object type to which the is related. For example, set this field to a UserId to post to someone’s profile feed, or an GroupId to post to a specific Group.
3) Type :-  The type of FeedItem . In our case it’s Textpost.
4) CreatedById :- It’s field contains the ID of user who is creating Chatter post.
To implement this for your organization follow the below instructions
1) Add one more value (Chatter) in Case Origin drop-down, by follow the path Name | Setup | App Setup | Customize | Cases | Fields same like below screenshot
2) Setup a new Email-to-Case, In Case origin drop-down select Chatter as shown in below scree shot


Setup Email-to-Case
Setup Email-to-Case

You will get an email from Salesforce to specified email address in email-to-case with a verification link, click on it and verify your email address. Now you can raise a case thorough email. Whenever you create a case via email, Email of subject –> Subject (Case Object),  Body of email –> Description (Case Object),  Case Origin set whatever you selected in email-to-case configuration (In our case it’s Chatter), Email –> Web Email (Case Object), Name –> Web Name (Case Object).
3) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
4) Click on New Flow, it will open flow canvas for you. Create Three text type variable UserID, EmailAddress andDescription (to pass email address from the case, Description to pass body of email through Workflow Rule Flow Trigger action) as shown in the below screenshot


Variables
Variables

5) In this step we will verify weather EmailAddress associated to any of the user’s account or not. To do that drag and drop a Record Lookup( Give the name Get User ID) onto the window and map the fields according to below details
  • Select Object User
  • Enter criteria Email= {!EmailAddress} (Variable)
  • Save ID of user in a variable ID= {!UserID} (Variable), as shown in the below screenshot


Get User ID
Get User ID

6) Next step is to verify weather variable {!UserID} have some value or not. If it’s null then it means no user exists with the same email (From email comes) address so discard the email. To do that drag and drop a Decision Element( Give the name User Exist or Not) onto the window and one Outcome same as below screenshot


Decision to know weather user exist with same email address
Decision to know weather user exist with same email address

7) Final step is to create Chatter Post. To do that drag and drop a Record Create( Give the name Create Chatter Post) onto the window and map the fields according to below details
  • Select Object FeedItem
  • Map the field Body= {!Description} (Variable)
  • CreatedById= {!UserID} (Variable)
  • ParentId= {!UserID}(Variable)
  • Type= TextPost, Don’t save Id of record into any variable. You can take help from below screenshot


Create Chatter Post
Create Chatter Post

7) Finally our flow will look like below screenshot
Post to Chatter by sending an email Flow
8) Save the flow with name (Email to Chatter Post)  and close the canvas.
Create Workflow rule to fire our Flow
Our next task is to create a workflow on Case object on create an event. To create a workflow on the Case object follow the below instructions
1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
2) Select object Case from the drop-down
3) Enter Name, for Evaluate the rule when a record is select Created, For Rule Criteria select is Case Origin=Chatter, as shown in the below screenshot


Workflow Rule on Case Creation when Case origin equals Chatter
Workflow Rule on Case Creation when Case origin equals Chatter

4) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow and set Variable (EmailAddress, Description) value as show in the below screenshot


New Flow Trigger Action
New Flow Trigger Action

5) Save the workflow and activate it.
It’s time to test this feature
To test this application follow the below steps
1) Copy Email Services Address from email-to-case
2) Open your email account (Email address that is related to your Salesforce user account)
3) Under To Address paste email Services Address type subject and under email body write a comment that you want to post to chatter, same as below screenshot


Email (Post to Chatter by sending an email)
Email (Post to Chatter by sending an email)

4) Now login into Salesforce Navigate to Chatter tab and check your post, below is the proof


Post to Chatter by sending an email
Post to Chatter by sending an email

Announcement:- If you like this blog or you have a question please leave your comments, I’ll try to answer it. Thanks for your time to read my article.

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget