Salesforce1: Preschedule Chatter Posts


In Salesforce Chatter is a great way to boost collaboration in your organization. You can Post Status, link, File and comment on others post etc. Many time I found on success community people is asking about a way to PrescheduleChatter Posts. But Salesforce doesn’t have any out-of -the box feature for this, so next way is use AppExchangeapp. In this article I show show how you can develop your own app for reschedule Chatter Posts that to without code.
Business Use case :- Higher management in Universal Container wants to develop an application for  their organization from where they can preschedule Chatter posts. They also want to use this app on Salesforce1.
Solution of above business requirement
I think this is a good use case to start with Flow Trigger (Pilot). To solve this requirement you have to use Record Create, Record delete elements. You have to also use Flow Trigger (Pilot) for fire/invoke Visual Workflow from workflow rule. With the power of Visual Workflow, we will create an app without using a single line of code. 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.
First create a custom object (Chatter Post) for Preschedule Chatter Posts. Also Create the fields that mentioned below
Name
Data Type
Required
Description
Body of Chatter Post
Text(100)
Yes
Type your message here that you want to post
Post date
Date/Time
Yes
Enter date when you want to post message
User Name
Lookup (User)
Yes
Where you want to post message (Any specific user’s wall)
Start
Checkbox
No
Set by WFR

In this demo I use User Name field as lookup where you have to enter user name. If you want to use same field for both user or group then change this field data type to Text and then you have to enter ID of user or Group where you want to post. Make sure your custom object will look like below screenshot

In this app we will use two workflow, as you all are aware of we can’t use Flow Trigger (Pilot) with time-based Workflow. Every time when you create a new record for custom object (Chatter Post) our first time-based workflow will fire and set Start checkbox to true according to your Post date. Because of this field update action it will fire another workflow rule that will invoke your Flow and post your message on Chatter . Once our post is published onChatter it will delete your record from custom object (Chatter Post).
Note:- In this article I used Flow Trigger (Pilot) feature.
Now we will create a flow to post your message on chatter and delete custom object (Chatter Post) after post. To do that follow the below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open flow canvas for you. Create two text type variable Body and ParentID.
3. Drag and drop a Record Create ( Give the name Chatter Post) onto the window and map the fields with variable and set Type = TextPost as per below screenshot

4) Create another text type variable RecordId and Drag and drop a Record Delete ( Give the name Delete Chatter Post Record) on the window. Under object select Chatter_Post__c  and map ID–> Variable {!RecordID}. As shown in below screenshot

5) Finally our flow will look like below screenshot

6) Save the flow and close the canvas.
Create Workflow rule to schedule chatter post
Our next task is create a time-based workflow to set Start checkbox to true according to your Post date. To create workflow on Chatter Post object follow the below instructions
1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
2) Enter Name, for Evaluate the rule when a record is select Created, For Rule Criteria select is Body of Chatter Post!= Null, as shown in the below screenshot

3) Add one time trigger One hours after Post date, as shown in the below screenshot

4) Add one Time-Dependent Workflow Actions field update to set Start checkbox to true ,as shown in the below screenshot

Note:- Don’t forget to select Re-evaluate Workflow Rules after Field Change checkbox.
5) Create another workflow on Chatter Post object. Enter Name, for Evaluate the rule when a record is selectCreated, and every time it’s edited, For Rule Criteria select is StartTrue , as shown in the below screenshot

6) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow and set Variable value as show in the below screenshot

It’s time to test this feature
open your app Salesforce1 and create one record for Chatter Post object, as shown in the below screenshot
To make sure about your working is working correctly check Time-Based Workflow Queue. To do so follow the path Name | Setup | Administration Setup | Monitoring | Time-Based Workflow and use filter criteria like object  =Chatter Post

Once  Scheduled Date over go to Chatter tab and see the magic and your record will get deleted from Chatter Post object.



Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

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