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 search easier for you. For example, if you post that you’re working on a presentation for Dreamforce15, you might want to add the hashtag topic #Dreamforce15 or #DF15 in your updates. Anyone can click on these topics to find out more information about Dreamforce15 and see what people and groups are talking about Dreamforce15. You can also find all records tagged with topic Dreamforce15. Let’s start with a business use case
Business Use Case
Pamela Kline is working as System administrator at Universal Containers (UC). She has received a requirement from the management, whenever an Opportunity is created with an amount more than 1M auto adds existing topic #KeyAccount to that particular opportunity record.
Solution for the above business requirement
There are a few possible solutions for the above business scenario, but we’ll use Flow and Process Builder to solve the above business requirement. Before going ahead with the solution, you have to understand TopicAssignment and Topic Object.
TopicAssignment: – It represents the assignment of a topic to a particular feed item or record.
Topic: – It Represents a topic on a Chatter post or record.
Follow the below instructions to create a Process Builder and Flow to solve the above business requirement
1. click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create a Text Variable to store the topic KeyAccount Id, as shown in the following screenshot
Also, create another Text Variable VarT_OppId to store the Opportunity Id
3. The next step is to use Record Lookup element to get the topic #KeyAccount Id. To do this drag-and-drop a Record Lookup (Enter the name Topic KeyAccount Id) onto the canvas and map the fields according to below details
- Select Object Topic
- For criteria, select Name= KeyAccount, save the record Id into the Text variable as shown in the following screenshot
4. The final step is to add #KeyAccount topic to the opportunity record, drag-and-drop Record Create element (Enter the name Assign Topic to a record) onto the canvas and map the fields according to below details.
- Select Object TopicAssignment
- For criteria, select EntityId= {!Var_OppId} and TopicId= {!VarT_TopicId}, as shown in the following screenshot
5. Finally, your Flow will look like the following screenshot
7. Save your flow with name Assign a topic to a record and close the canvas. Don’t forget to Activate the Flow.
Launch a Flow from Process Builder
Our next task is to create a Process Builder on the Opportunity object to launch a Flow. To create a Process Builder on the Opportunity object follow below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
2. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear, where you have to enter the Name (Use Auto assign a topic to a record as a name), API Name and Description as shown in the below screenshot.
3. Click on Object node to add object and then select Opportunity object. For the entry criteria, Select only when a record is created, as shown in the below screenshot
4. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Opportunity].Amount Greater than or Equals Currency 1000000) and click on the Save button as shown in the following screenshot
5. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Flows), and then fill the values into fields to define the action, as shown in the following screenshot.
6. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally, the Process will look like the following screenshot
Don’t forget to active the Process by clicking on the Activate button.
Proof of concept
1) Navigate to the Opportunities tab and create a new Opportunity record with an amount 1200,000, as shown in the following screenshot
2) Checkout the Topic section of the page
Note: – I will suggest you to implement this first on your developer org, test it and then move it to the production.