Topics are a great way to organize or increase post and comments visibility. For example, if you post that you’re working on a presentation for your customer Universal Container, you might want to add the hashtag topic #UniversalContaineror #UC in your update. Anyone can click on these topics to find out more information about Universal Container and to see which peoples and groups are talking about Universal Container.
Before Summer’14release if you want to Delete Topics the only way is by using the SOAP API, Chatter REST API, Developer console, My App or Chatter in Apex. But after Summer’14 you can easily delete them right on topic detail pages.
Business Use case :- Business users in Universal Container want a way to delete Topics from Salesforce. In this demo I will delete Topic Summer’14.
Solution of above business requirement
To Delete Topic directly in Salesforce it’s required Delete Topicsuser permissions. To Delete Topic from Salesforce UI follow the below instructions
1) Navigate to Topics detail page, In our case Topic Summer’14 2) In the upper-right corner of a topic detail page, click on drop Down and Select Delete options, as shown in the below screenshot
3) From the same menu, you can now edit details such as the topic name and description, or add a topic as a favorite etc.
ChatterTopics helps you to associate your updates with other posts and comments on the same topic by using a hashtag (#). By using hashtags, you create a topic link that categorizes your update so other users in your company can find it more easily. You can also use Chatter Search to find updates and comments that match the Chatter Topic you are looking for. Now I am coming to the point way to delete Topics in Salesforce. In Salesforce document it’s mentioned People with the “Modify All Data” or “Delete Topics” permission can delete topics using the Chatter API or theSOAP API. Another way to delete Topics is using Developer console or Workbench.
Business Use Case
Higher management at Universal Containers wants to develop an application, from where they can easily delete Topics. Their system administrator frustrated from the old way from where every time they have to query to delete topics by using Developer console or Workbench.
Solution for the above business requirement
Again this is the power of Visual Workflow, we will create an app without using a single line of code. Our app starts with a screen where the user can enter topic he/she want to delete, as soon as he/she can delete next topic will delete from Salesforce. To develop additional functionality 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 Enter Topic) on the window, add one field ( Give the name Enter Topic Name) and make it required as shown in below screenshot
Enter Topic Name
The next work is deleting entered topics. Before going ahead you have to understand about TopicsObject. It represents a topic on a Chatter post or record.
Drag and drop a Record Delete ( Give the name Delete Topic) on the window. Under object select Topic, and Map Name –>Input field from last screen. as shown in below screenshot
Finally, our flow will look like below screenshot
Flow for delete topic
Save the flow and close the canvas.
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
Create custom link from Name | Setup | App Setup | Customize | Home | Custom Link
Add custom link in the Home page component
Add Home page component into the Home page layout
Add flow on home page layout
It’s time to test this feature
Now we will delete ChatterTopics through our app. Currently I have three topics in my Org you can see below screenshot.
Topics available in my org
Open our app and enter Topics that you want to delete. In my case I am going to delete Topicschr and click on the Next, as shown in below screenshot
Enter Topic Name and click on next
Now check Topics, as shown in below screenshot
Proof of concept
Note: – When deleting topics, consider below points
Topics are hard deleted. They aren’t sent to the Recycle Bin.
Deleted topics are removed from search results, the topics list, all posts and records, Recently Talked About topics, Related Topics, and your users’ favorites. Deleted topics are removed from Trending Topics after the next calculation.
Deleted topics are not blacklisted. Users can reintroduce a topic after it’s been deleted.
Use this app on Salesforce1
To use this app on Salesforce1 , create a Visualforce Page, Select Available for Salesforce mobile apps check box and embed your Flow and crate a Visualforce Tabs to call it. Below is the sample code for your reference