Skip to content

Show responses on other records

Responses are linked to the contact who answered. This guide shows them on the contact's account as well, with a lookup field and a flow. Use it as a pattern for other records, e.g. the case or opportunity a survey was about. Your org may need extra conditions in the flow.

Responses on an account page

Before you start

  • The nps.today package is installed and syncs responses, see Install the package.
  • You can create fields and flows in Salesforce.

Step 1: Add a lookup field to NPS Response

The lookup field holds the account of each response.

  1. Go to Setup → Object Manager → NPS Response → Fields & Relationships, and click New.

    New field

  2. Choose Lookup Relationship and click Next.

    Field data type

  3. Related To: Account. Click Next.

    Field object

  4. Field Label: Account. The Field Name becomes Account, and the API name Account__c. Click Next.

    Lookup field

  5. Click Next on the field-level security and page layout steps, and then Save.

The NPS Response object now has the field Account__c:

Account__c on NPS Response

Step 2: Create the flow

The flow runs every time a response is synced, finds the contact who answered, and writes the contact's account to Account__c.

  1. Go to Setup → Process Automation → Flows, click New Flow, choose Record-Triggered Flow and click Create.

    New flow

  2. Set up the Start element:

    Object: NPS Response
    Trigger the Flow When: A record is created or updated
    Condition Requirements: None
    Optimize the Flow for: Fast Field Updates

    Trigger object Configure trigger Optimize flow

  3. Add a Decision after Start, to check that the response has a respondent:

    Label: Has respondents?
    Outcome Yes: Resource Triggering NPS Response → Respondent (shown as $Record > Respondent) Is Null False
    Default outcome: rename it to No

    Decision: has respondent

  4. On the No path, add an Assignment that clears the account:

    Label: clear_respondents
    Variable: {!$Record.Account__c} Equals {!$GlobalConstant.EmptyString}

    Assignment: clear Account__c

  5. On the Yes path, add Get Records, to fetch the contact who answered:

    Label: Get Records on Contacts
    Object: Contact
    Condition: Id Equals Triggering NPS Response → Respondent ($Record > Respondent)
    How Many Records to Store: Only the first record
    How to Store Record Data: Automatically store all fields

    Get records Get records conditions

    The flow now looks like this:

    Flow so far

  6. After Get Records, add a second Decision, to check that the contact has an account:

    Label: Account decision
    Outcome No AccountID: {!Get_Records_on_Contacts.AccountId} Is Null True
    Default outcome: rename it to Has Account

    Decision: has account

  7. Connect the No AccountID outcome to the clear_respondents assignment from step 4.

    Flow with both decisions

  8. On the Has Account outcome, add an Assignment that sets the account:

    Label: Set Response on Account
    Variable: {!$Record.Account__c} Equals {!Get_Records_on_Contacts.AccountId}

    Assignment: set Account__c

  9. Check that the flow looks like this, then Save and Activate it.

    The finished flow

Note

The flow runs when a response is created or updated, so responses that were synced before you activated it don't get an account until they are updated.

  1. Go to Setup → Object Manager → Account → Page Layouts, and open the layout your users use.
  2. Click Related Lists in the palette, and drag NPS Responses onto the layout.

    Related list

  3. Click the wrench icon on the related list and choose the columns, e.g. as below.

    Related list - edit Related list columns

  4. Click OK, then Save the Account layout.

Step 4: Check it

Open an account with a contact who has answered a survey. The response is in the NPS Responses related list.

Responses on the account