Posted at 6:00 PM by Rakesh Gupta, on December 24, 2020
Big Idea or Enduring Question:
How can you allow your users to add a topic to multiple records?
How do you pass record IDs from a list view to Salesforce Flow?
Topics for Objects, allow us to organize the records by using topics same as Chatter.Topics help to organize records in a better way and make the search easier for you. For example, if you post that you’re working on a presentation for Dreamforce20, you might want to add the hashtag topic #Dreamforce20or #DF20in your updates.
Anyone can click on these topics to find out more information about Dreamforce20 and see what people and groups are talking about Dreamforce20. You can also find all records tagged with the topic Dreamforce20.
In the past written a few articles related to Topics and automation. You may want to check them out.
I have never found an out-of-the-box solution to Add a Topictomultiple records. In this article, we will create automation for similar functionality without using code.
Objectives:
This blog post will help us to understand the following
Launch a Flow from the list view and pass the selected record ids to Flow
Use a Screen a flow to take the user input
Use a Decision element to find – record variable contains a record or not
Use Flow to Create Records (Bulk safe)
Business Use Case
Brenda David is working as a System administrator at Universal Containers (UC).She has received a requirement from the management to create an automation that allows users to add a topic to selected records (Opportunities) in the list view.
Automation Champion Approach (I-do):
There are a few possible solutions for the above business scenario. We will use Salesforce Flow, Custom Button,andListViewto solve the requirement.
Let’s take a pause here, familiar yourself with theTopicAssignmentandTopicObjects in Salesforce.
It Represents a topic on a Chatter post or record.
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.
Let’s begin building this automation process.
Guided Practice (We-do):
There are 3 steps to solve Brenda’s business requirement using Screen Flow. We must:Read the rest of this entry!
Posted at 6:36 PM by Rakesh Gupta, on August 18, 2014
Topics are a great way to organize or increase post and comment visibility. For example, if you post that you’re working on a presentation for Dreamforce’14, you might want to add the hashtag topic #Dreamforce14 or #DF14 in your updates. Anyone can click on these topics to find out more information about Dreamforce’14 and see what people and groups are talking about Dreamforce’14. After Summer’14 Salesforce allows you to the Delete topic from Salesforce User Interface, but not merge two different Chatter Topics. I have never found any apps or out of the box, solution to merge two different Chatter Topics. In this article, we will develop the same app without using code.
Business Use Case
People at Universal Container are using Chatter hashtag to organize their posts. Management in Universal Container wants to develop an application so that their system administrator can merge two different Topics (For example ABC & DEF).
Solution for the above business requirement
To solve above business requirement, we will use Visual Workflow and fire this flow will use Custom Link. Before going ahead with the solution, you have to understand about TopicAssignmentObject. It represents the assignment of a topic to a specific feed item or record. Below are the key fields from TopicAssignmentobject
Field Name
Details
EntityId
Identifier of the feed item or record.
TopicId
Identifier of the topic.
To develop this application 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 Three variable
Topics (SObject variable – TopicAssignment type )
GetAllPostFromTopics and NewTopicDetails (SObject Collection Variable – TopicAssignment type)
Sobject Variables
3) Drag and drop a Screen Element ( Give the name Merge Topics) onto the window and add two fields with below detail
Name
Data Type
Required
Old Topic ID
Textbox
Yes
New Topic ID
Textbox
Yes
It will look like the below screenshot
To Get User’s Input
4) Drag and drop a Fast Lookup ( Give the name Get all post from Old Topic ) onto the window to get all posts, links etc from old Chatter Topicand map the fields according to below details
Select Object TopicAssignment
TopicId= {!OldTopicID} [OldTopicID is nothing but Screen Input field], Save Id of records into any variable in our case it’s {!GetAllPostFromTopics} Sobject Collection variable. You can take help from the following screenshot
Extract all Posts from old Topic
5) Drag and drop a Record Delete ( Give the name Delete Old Topic) on the window. Under object select Topic, and map ID–>{!OldTopicID}, as shown in below screenshot
Delete Old Topic
6) Drag and drop a Loop Logic (Give the name Extract post one by one) on the window and extract post from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot
Loop Over Topic Assignment
7) Drag and Drop Assignment Logic (Give the name Update Topic ID) on the window and assign value of Screen input {!NewTopicID} to Sobject variable variable {!Topic.TopicId} so that all posts from an Old Topic to assign New Topic. Take the help from the below screenshot
Update Topic ID
8) Drag and Drop Assignment Logic (Give the name Add all posts Into New Collection) on the window and assign value from Sobject variable {!Topic} to Sobject Collection variable {!NewTopicDetails} so at the end of for loop we will have all posts from Old Topic into One collection with updated Topic ID. Take the help from the below screenshot
All in One
9) Finally drag and Drop Fast Create (Give the name Record Create) on the window to add all posts from an Old Topic to New Topic, It means we are creating their reference in TopicAssignment object, as shown in the below screenshot
Move Posts from one Topic to another
10) Finally our flow will look like the below screenshot
Merge Chatter Topics
11) Save the flow with name (Merge Chatter Topic) and close the canvas.
Add Visual workflow into the home page component
We can call Flow from the custom button, link, sub-flow, Visualforce page, Apex start() or using Flow Trigger workflow action. Here we will call our flow using Custom Link available in the homepage component. To do that, follow below instruction:
1) Create custom link from Name | Setup | App Setup | Customize | Home | Custom link
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
1) In this demo, I will Merge Chatter Topic Dreamforce (Old) with Salesforce (New)
2) To get Topic ID, for Topic Dreamforce take a look at the below screenshot
How To Get Topic ID
3) To open this app click on “Merge Chatter Files” link available on the homepage, and fill the details you can take help from below screenshot
Open Merge Chatter Topic app
4) Now enter old and New Topic ID, In my case Dreamforce is Old Topic and Salesforce is New Topic and click on Next Button, as shown in the below screenshot
Merge Chatter Flow
Your all Posts Including Status Update, links, polls or files are moved to new Topic.
Note: – I will suggest you to Implement this first on your developer org, test it and then move it to Production. Let me know if you have any difficulty to Implement it.