Learning Flow: Chatter group data cleansing


Chatter Group is playing a key role in internal collaboration for an organization. Peoples who are members of  aChatter group they can post Status,  linkfile etc.
Business Use case :- Universal container management wants to to delete post from Chatter Group ( Salesforce project ) that created before today.
Solution of above business use case
There are few ways to solve above business requirement, that I am aware of
  1. Delete Manually
  2. Data Loader
  3. Visual Workflow
Here I will discuss way to delete Chatter post for certain groups by using visual workflow. Before going ahead you have to understand about few object that represent Chatter Group and Chatter feed.
CollaborationGroup :- This object represents a Chatter group.
CollaborationGroupFeed :- This object represents a single feed item on a Chatter group feed.
Create Visual workflow
We will create a screen from where user can select a Chatter Group and the enter date,So the post will delete according to date and group.
Now we will go ahead and create flow, to do this follow the below instructions
  • Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows 
  • Click on New Flow, it will open flow canvas for you
  • Drag and drop a Screen ( Give the name Group list) on window, and click on Add a Field as shown in below screenshot

  • The next step is show Chatter group name dynamically in the drop-down, to do that add field Drop-down (Name – Show list of groups) and create new dynamic choice, as shown in below screenshot

  • Enter Choice Unique Name, Select CollaborationGroup option under create a choice for drop-down, under filter criteria select id <>  {!$GlobalConstant.EmptyString}. Store Group id to a variable in my case it’s GroupID, you can take help from below screenshot. Once done click on Ok to save it

  • Now we will create a Date field to take user input. According to date entered by user we will delete all feed before that date. Drag & drop a Date field into the screen (Enter label – Enter date) and make itrequired ass shown in below screenshot

  • Now we will delete the feed item from chatter group. To do that drag and drop Record Delete into the screen. Enter NameUnique Name, from delete drop-down select CollaborationGroupFeed object. Navigate to filter section and map LastModifiedDate –> Enter date (Input choice from screen),ParentId–> GroupID (we store groupid in screen 1). As shown in below screenshot

Note:-Parentid represent ID of the group that is tracked in the feed.
Connect both the item and set screen as start element, as shown in below screenshot

Add Visual workflow into the home page component
We can call flow from custom button, link, sub-flow, visualforce page. Here we will call our flow from the home page component. To do that follow below instruction
  1. Create custom link from Name | Setup | App Setup | Customize | Home | Custom link
  2. Add custom link in the Home page component
  3. Add Home page component into the Home page layout
It’s time to test this feature
Now we will delete all post from  Chatter Group ( Salesforce project )  as per business use case.

To launch flow go to home tab and click on custom link, as shown in below screens hot

it will launch flow, select Chatter group and enter date as per your choice and click on Next, so flow will delete all post prior to date entered. you can take help from below screenshot

It will delete all post from group you selected.

Use this app on Salesforce1
To use this app on Salesforce1, create a Visualforce Page, And embed your Flow and crate a Visualforce Tabs to call it. Belw is the sample code for your reference
<apex:page >
<br/>
<Center><Font size =”6″ color =”orange”>Chatter Group Feed Cleansing</font></Center>
<br/><br/>
<flow:interview name=”Group_member”/>
</apex:page>
It will look like below Screenshot on Salesforce1 App

Note :- If you want to resize (limit) flow screen then use .FlowContainer class. below is the sample code
<style type=”text/css”>
.FlowContainer{
width:30%;
}
</Style>

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

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