Salesforce関連の記事を書いています。

  1. Salesforce

How to get the text of a related list in Salesforce and store it in an item

Introduction.

When using Salesforce in business, there is a frequent need to display information from related lists together in a parent record. For example, when a sales representative checks a client’s information, instead of having to click through to the related list each time to check the past activity history, it would greatly improve operational efficiency if the latest activity details could be seen at a glance on the client’s screen.

Such requirements are difficult to achieve using only the standard features of Salesforce, and can be implemented using flows (especially record trigger flows).

This article explains in detail how to utilize the standard Salesforce functionality of Flow to retrieve information from related objects and store it in parent record items, so that even novice users can implement it.

Why should the information of the related list be displayed in the parent record?

The advantages of displaying related list information in the parent record include the following

  1. Faster access to information: users can see the information they need without having to click on the related list
  2. Use in reports and dashboards: Saving the information as an item in the parent record facilitates aggregation and analysis in reports and dashboards
  3. Flexibility to customize page layout: key information can be placed in a separate location from related lists
  4. Conditional display and formatting: Saving in text format allows for visual enhancement using HTML and rich text features
  5. Expanded data utilization: Saved information can be used as a condition for another process

Use Cases to be Implemented

This article explains the implementation method assuming the following use cases:

  • Parent object: Customer (Account)
  • Child object: Activity (Task)
  • What we want to achieve: To store the “Subject”, “Due Date”, “Status”, and “Contact Person” information of the latest three activities (Tasks) associated with a trading partner in a custom item named “Latest Activity Summary __c” of the trading partner.
  • Operational value: When a sales representative opens a trading partner page, he/she can immediately see the most recent communication history and tasks in progress.

This feature is expected to improve the quality of customer correspondence and increase the operational efficiency of the sales team.

Step 1: Preparation and creation of custom items

First, create the necessary custom items for the trading partner object.

  1. Open the ” Object Managerfrom the Salesforce settings.
  2. ***Select the “Business Partners “** object and click on ” Items and Relations
  3. Click the ” New” button and create a custom item with the following settings:
    • Data type: long text area
    • Item display label: Latest activity summary
    • Item name: LatestActivitySummary
    • Number of display rows: 5
    • Item Description: Automatically displays the three most recent activities associated with a trading partner
    • Help text: This item automatically displays information on the three most recent activities. No editing is required.

Step 2: Creating a Flow

Next, create a flow that will be executed automatically when an activity (Task) is created or updated.

2.1 Basic Flow Settings

  1. Open ” Flows ” from Salesforce settings
  2. Click the ” New Flow ” button and select **”Record Trigger Flow “**.
  3. Configure the following settings:
    • Select object: ToDo
    • Set trigger: record created or updated
    • Set entry conditions: None
    • Optimize flow: Actions and related records

2.2 Setting Conditional Split

Activity (Task) objects can associate multiple types of objects (e.g., business partners, business meetings, etc.) to the WhatId field. Therefore, set up a conditional branch so that the flow is executed only when the WhatId refers to a business partner (Account).

  1. Adding a Decision Factor
    • Element name: Business partner related check
    • API reference name: AccountCheck
    • Condition name: WhatId is a trading partner
    • Resulting API reference name: WhatIdisAccount
    • Condition: { !$Record.WhatId} starts with “001” (Note: In Salesforce, the trading partner ID starts with “001”)

2.3 Retrieving Related Tasks

Next, retrieve the latest Task record associated with the related trading partner of the triggered Task.

  1. Add a record acquisition element
    • Element name: GetRelatedTasks
    • API reference name: GetRelatedTasks
    • Records to be acquired: Multiple records
    • Get records of this object: Todo(Task)
    • Refine Todo records:
      • WhatId” “Matches the following string” "{! $Record.WhatId}"
      • (More detailed conditions can be added by setting “Status does not equal ‘completed'”)
    • Sort by: CreatedDate in descending order (latest first)
    • Number of records to save: “All records, up to a specified limit”
    • Maximum number of records to save: “3”

2.4 Processing of acquired related task information

Formats the retrieved activity information for easier viewing.

  1. Creating a new resource
    • Resource: Text Template
    • API reference name: Texts
    • Text: Fill in the text as shown in the figure below.
Subject: {!TaskLoop.Subject}
Description: {!TaskLoop.Description}
Contact: {!TaskLoop.Owner:User.LastName}{!TaskLoop.Owner:User.FirstName}
------------------------------
{!GlobalConstantEmptyString}

*Important point: {!GlobalConstantEmptyString} is a string to start a new line. (See below.)

Next, create a text variable for line breaks. This is a variable for line breaks.

Create the variable as follows

  • API reference name: GlobalConstantEmptyString
  • Data type: text
  • Default value: blank value (empty string)
  • {! $GlobalConstant.EmptyString} to set a blank value

Next, create a text variable to store all activities.

Create the variable as follows

  • API reference name: List
  • Data type: Text

Next, create an “assignment” element in the loop as shown below.

In other words, use the loop to perform the process of formatting and storing the three acquired activities in the Texts variable and summarizing the three activity contents in the List variable.

  • Display label: Text formatting
  • API reference name: TextFormating
  • Variable: List(variable)
  • Operator: Add
  • Value: Texts(variable)

2.5 Updating the parent record (trading partner)

Finally, save the formatted text (contents of the List variable) to the “LastestActivitySummary__c” field of the trading partner record.

  1. Add record update element
    • Element name: Trading Partner Update
    • API reference name: UpdateAccount
    • How to search for a record to update and set its value: Specify a condition to identify the record and set the item individually
    • Object: Business partner(Account)
    • Narrowing down the trading partner record: if the ID is {! equal to $Record.WhatId}.
    • Set the item value of the trading partner to the record:
      • LastestActivitySummary__c ← “List

2.6 Flow Completion and Activation

After “saving” the flow, “activate” it. This enables the flow to run in the Salesforce environment.

Variations: Practical Applications

This basic pattern can be applied in various business situations:

Example 1: Linking a business meeting and a quote

  • Parent object: Opportunity
  • Child object: Quote
  • Implementation: Display the latest valid quotation information (price, discount rate, etc.) in the Opportunity
  • Business effect: Sales representatives can immediately check the latest quote information on the Opportunity screen.

Example 2: Linking a business partner and the person responsible for the business partner

  • Parent object: Business partner (Account)
  • Child object: Contact person (Contact)
  • Implementation: Listing of information on key contacts (with the job title of “General Manager” or higher) to the business partner
  • Business Effectiveness: Account managers have immediate access to the contact information of key persons.

Example 3: Linking Case and Solution History

  • Parent object: Case
  • Child object: Case comment (CaseComment)
  • Implementation: Display the latest information of the response history in the case
  • Business Effectiveness: Support staff can immediately grasp the details of past responses

Summary

In this article, we explained how to display information in the related list on the parent record by utilizing the Salesforce flow. By utilizing this technique, the following benefits can be obtained

  1. More efficient access to information: Quickly check the information you need
  2. Expanded data utilization: Stored as an item in the parent record, it facilitates analysis and reporting
  3. Improved usability: Required information is displayed in an easy-to-read, organized manner
  4. Flexible customization: Information can be displayed according to business needs

Salesforce flows are powerful tools that can be highly customized without specialized development knowledge. Based on the techniques introduced in this article, we encourage you to try customizing it to suit your business needs.

Also, by applying this basic pattern, you can solve a variety of business issues. We recommend that you start with a small-scale implementation and gradually move on to more complex processes, making the most of Salesforce’s automation features to improve operational efficiency and the customer experience!

Salesforce recent post

  1. How to get the text of a related list in Sale…

  2. How to Improve Business Efficiency by Automat…

  3. How to automatically lock closed business mee…

  4. Changes and impact on how Account Engagement …

  5. How to set access rights in Salesforce by uti…

関連記事

PAGE TOP