---
title: "Salesforce notification: Send Chatter message to account owners when products are being compared"
slug: "example-notification-4-chatter-notification-for-salesforce-account-owners-when-a-g2-comparison-page-is-viewed"
updated: 2022-06-15T20:56:09Z
published: 2022-06-15T20:56:10Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.g2.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce notification: Send Chatter message to account owners when products are being compared

A buyer viewing G2 comparison pages for your product can be a clear signal that they are entering a critical stage of the buying process. Notifying your Salesforce account owners of this activity as it happens can provide an advantage over your competitors. This example notification sends a Chatter notification to Salesforce account owners when one of their mapped accounts views a comparison page for your product.

          
          

For more information on how to use Salesforce Chatter, review Salesforce’s [Trailblazer training course for Chatter](https://trailhead.salesforce.com/en/content/learn/modules/chatter/chatter_intro).

For more information on customizing your organization’sChatter feed, review Salesforce’s [Customize Chatter Feed Tracking](https://help.salesforce.com/articleView?id=sf.collab_feed_tracking.htm&amp;type=5) documentation.

### 1. Create the record-triggered flow

To create a new flow:

1. At the top-right corner of any Salesforce page, select **Setup**.
2. In the left sidebar, go to **Build** > **Create** > **Workflow and Approvals** > **Flows**.

          
          

If using Salesforce Lightning, go to **Process Automation** > **Flows**.

1. Select **New Flow** to open the Flow Builder.
2. Select **Record-Triggered Flow**, then **Create**.
3. Find the G2 Event object by searching for `G2Crowd__G2_Event__c` in the Object search box. Set Configure Trigger to **A record is created**.
4. Set Entry conditions.

For this example, the entry conditions are used to filter for new G2 Event Tags that indicate a buyer organization has compared your product to a competitor. Set the Conditions Requirements dropdown to **All Conditions Are Met (AND)** and add the following conditions:

| Row | Field | Operator | Value | Description |
| --- | --- | --- | --- | --- |
| 1 | `G2Crowd__Tag__c` | Starts With | `comparisons` | Screens for the G2 Event tag for comparisons ( ```comparisons.show’’ )’ |
| 2 | `G2Crowd__Account__c` | Is Null | `False` | Does not send a notification if G2 could not determine the organization responsible for the signal. Salesforce refers to this value as `$GlobalConstant.False` |

1. Set Optimize the Flow to **Actions and Related Records**, then select **Done**.
2. In the top-right corner of Flow Builder, select **Save**, then enter a name for your Flow (Flow Label). The Flow API Name auto-populates based on your Label entry.
3. Select **Save** to finalize your Flow creation.

### 2. Create the notification Resources

Resources enable you to create custom variables, formulas, and text templates to customize your notification with specific event data, such as a record URL, an account name, and the account owner’s Salesforce ID. This notification uses variables to fill in G2 Event data, formulas to fill in direct URLs to the account and event records, and text templates to use the variables and formulas in the notification message body.

To create the variables for your notification:

1. In the left sidebar of the Flow Builder, select **New Resource**, then select **Variable** from the Resource Type dropdown.
2. Enter an API Name (this is the name for your variable), check **Available for input**, and set the Data Type to **Text**. A Default Value box will appear.

          
          

To enter a Default Value, you must understand how to access G2 custom objects in Salesforce.

![adding a variable](https://cdn.document360.io/1759d01c-b118-4f31-81f7-e4011071a6d4/Images/Documentation/adding%20a%20variable.gif)

For example, to access the email address of an account owner, select **Record** > **G2Crowd__Account__** > **Owner** > **Email**. You must select the dropdown option at each step to build your Default Value. Your final Default Value is `$Record.G2Crowd__Account__r.Owner.Email`.

The following table illustrates the API Name, the Default Value, and the search queries you should enter into the text box to quickly access the correct value.

| API Name | Default Value | Search query |
| --- | --- | --- |
| EmailAddress | `$Record.G2Crowd__Account__r.Owner.Email` | **Record** > **Account__r** > **Owner** > **Email** |

1. Repeat steps 1 and 2 for each of the following variables, making sure to check **Available for input** and set the Data Type to **Text** for each new variable:

| API Name | Default Value | Search query |
| --- | --- | --- |
| OwnerID | `$Record.G2Crowd__Account__r.OwnerId` | **Record** > **Account__r** > **OwnerId** |
| AccountID | `$Record.G2Crowd__Account__c` | **Record** > **Account__c** |
| AccountName | `$Record.G2Crowd__Account__r.Name` | **Record** > **Account__r** > **Name** |
| G2Title | `$Record.G2Crowd__Title__c` | **Record** > **Title** |
| FirstName | `$Record.G2Crowd__Account__r.Owner.FirstName` | **Record** > **Account__r** > **Owner** > **First Name** |
| LastName | `$Record.G2Crowd__Account__r.Owner.LastName` | **Record** > **Account__r** > **Owner** > **Last Name** |
| Time | `$Record.G2Crowd__Time__c` | **Record** > **Time** |
| G2URL | `$Record.G2Crowd__URL__c` | **Record** > **URL** |
| G2EventID | `$Record.Id` | **Record** > **Record ID** |
| City | `$Record.G2Crowd__City__c` | **Record** > **City** |
| State | `$Record.G2Crowd__State__c` | **Record** > **State** |
| Country | `$Record.G2Crowd__Country__c` | **Record** > **Country** |

To create formulas to populate your notification with Salesforce URLs that link directly to the G2 Event and account:

1. In the left sidebar of the Flow Builder, select **New Resource**, then select **Formula** from the Resource Type dropdown.
2. Set the Data Type to **Text**,  enter the following information to build an account URL, then select **Done**:

| API Name | Formula | | --- | --- |--- | | AccountURL | `LEFT({!$Api.Partner_Server_URL_260}, FIND( '/services', {!$Api.Partner_Server_URL_260})) + "/lightning/r/AccountID/" + {!AccountID} + "/view"` |

1. Repeat step 2 with the following information to build a G2 Event record URL:

| API Name | Data Type | Formula |
| --- | --- | --- |
| G2EventURL | Text | `LEFT({!$Api.Partner_Server_URL_260}, FIND( '/services', {!$Api.Partner_Server_URL_260})) + "/lightning/r/EventID/" + {!G2EventID} + "/view"` |

To create the text template for your notification message body:

1. In the left sidebar of the Flow Builder, select **New Resource**, then select **Text Template** from the Resource Type dropdown.
2. Enter the name for your message template under **API Name**. G2 recommends the name **MessageBody**.
3. Set the View dropdown to **View as Plain Text**.
4. Enter your notification message into the Body text box. Your message should use the custom variables you created to fill in relevant data. Select **Insert a resource** to add one of the variables you created. For this example, you can paste the following message into the Body:

```
@[{!OwnerID}]
{!FirstName} {!LastName},
{!AccountName} has a Buyer Intent signal on G2.com.
G2 Page Title: {!G2Title}
G2 URL: {!G2URL}
Time of the G2 Activity: {!Time}
G2 Event Link: {!G2EventURL}
Account Link: {!AccountURL}
User Location: {!City}, {!State}, {!Country}
-Your Salesforce Admin
```

1. Select **Done**.

### 3. Add the Chatter notification Action

![add chatter notification](https://cdn.document360.io/1759d01c-b118-4f31-81f7-e4011071a6d4/Images/Documentation/add%20chatter%20notification.gif)

1. Select the **+** below the the Record-Triggered Flow Start, then select **Action**.
2. Search for and select **Post to Chatter** to open the New Action editor.
3. Enter a **Label** for your action, such as Chatter Post for G2 Events. The API Name auto-populates based on your label entry.
4. Select your **MessageBody** Text Template from the Body search box.
5. Select your **AccountID** Variable from the Target Name or ID search box.
6. Select  **Done** to commit your changes.

### 4. (Recommended) Test and activate your flow

G2 strongly recommends testing your flow before activation. To test your flow:

1. Select **Debug** from the Flow Builder top-right menu.
2. Leave all parameters set to their default settings.
3. Enter a G2 Event ID into the G2 Event search bar to debug your event using a specific test case. You might have to go to the G2 Events tab in a separate window to find Event IDs.

          
          

G2 recommends choosing an event that meets your entry conditions and one that does not meet your entry conditions to assess that your Flow behaves as intended. For this example, test a G2 Event record with the Tag `comparisons.show`, then test one that does not have the proper tag.

1. Select **Run** to begin your debug.
2. Open the **Start Condition Requirements** and Action (denoted by a **lightning bolt icon**) tabs to view how your Text Templates were filled with your custom Variables and Formulas.
3. When satisfied, select **Activate** to turn on your flow.

## Related

- [Understanding example notifications](/understanding-example-notifications.md)
