Salesforce notification: Email account owners when their accounts are researching alternatives to your product
  • 15 Jun 2022
  • 6 Minutes to read
  • Dark
    Light

Salesforce notification: Email account owners when their accounts are researching alternatives to your product

  • Dark
    Light

Article Summary

A customer viewing a G2 alternatives page that features your product could indicate that they are at risk for churn. Notifying your Salesforce account owners of this activity as it happens provides an opportunity to contact your customer, offer educational materials, and make them aware that help is available.

This example notification sends an email to Salesforce account owners when one of their accounts views a G2 alternatives page featuring your product.

Alternative signals are generated when a buyer views an alternative page for any product in your G2 category. This flow only sends a notification when a buyer views an alternative page that features your product in the title. For example, an alternatives page featuring G2 Marketing Solutions could be titled "G2 Marketing Solutions Alternatives for Small Businesses in 2022".

For more information on which Buyer Intent signals are included in your subscription, refer to G2 Plans.

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 alternative pageviews that indicate a buyer organization is specifically looking for alternatives to your product. Set the Conditions Requirements dropdown to All Conditions Are Met (AND) and add the following conditions:

RowFieldOperatorValueDescription
1G2Crowd__Tag__cContainscompetitorsFinds the G2 Event tag for alternatives pageviews ( products.competitors )
2G2Crowd__Account__cIs NullFalseDoes not send a notification if G2 could not determine the organization responsible for the signal. Salesforce refers to this value as $GlobalConstant.False
3G2Crowd__Title__cContains{{your product name}}Checks if the G2 alternatives page featured your product. For example, entering G2 Marketing Solutions as the value would match the page title "G2 Marketing Solutions Alternatives for Small Businesses in 2022"
  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 email address. 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), set the Data Type to Text and check Available for input. 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

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 NameDefault ValueSearch query
EmailAddress$Record.G2Crowd__Account__r.Owner.EmailRecord > Account__r > Owner > Email
  1. Repeat steps 1 and 2 for each of the following variables, making sure to set the Data Type to Text and check Available for input for each new variable:
API NameDefault ValueSearch query
EmailAddress$Record.G2Crowd__Account__r.Owner.EmailRecord > Account__r > Owner > Email
AccountID$Record.G2Crowd__Account__cRecord > Account__c
AccountName$Record.G2Crowd__Account__r.NameRecord > Account__r > Name
G2Title$Record.G2Crowd__Title__cRecord > Title
FirstName$Record.G2Crowd__Account__r.Owner.FirstNameRecord > Account__r > Owner > First Name
LastName$Record.G2Crowd__Account__r.Owner.LastNameRecord > Account__r > Owner > Last Name
Time$Record.G2Crowd__Time__cRecord > Time
G2URL$Record.G2Crowd__URL__cRecord > URL
G2EventID$Record.IdRecord > Id
City$Record.G2Crowd__City__cRecord > City
State$Record.G2Crowd__State__cRecord > State
Country$Record.G2Crowd__Country__cRecord > 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 NameFormula
AccountURLLEFT({!$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 NameData TypeFormula
G2EventURLTextLEFT({!$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. To insert a variable, select Insert a resource. For this example, you can paste the following message into the Body:
{!FirstName}{!LastName},
{!AccountName} is looking for alternatives to your product 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.

To create the text template for your notification subject line:

  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 subject line template under API Name. G2 recommends the name MessageSubject.
  3. Set the View dropdown to View as Plain Text.
  4. Enter your notification message into the Body text box. Select Insert a resource to add one of the variables you created. For this example, you can paste the following message into the Body:
{!AccountName} is looking for alternatives
  1. Select Done.

3. Add the email notification Action

adding an action

  1. Select the + below the the Record-Triggered Flow Start, then select Action.
  2. Search for and select Send Email to open the New Action editor.
  3. Enter a Label for your action, such as Email Notification. The API Name auto-populates based on your label entry.
  4. Select your MessageBody Text Template from the Body search box.
  5. Select your MessageSubject Text Template from the Subject search box.
  6. Set the Email Addresses (comma-separated) slider to Include. Select the EmailAddress variable you created earlier in this process.
  7. Select Done to commit your changes to the action. Select Save to apply your changes to the flow.

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 an alternatives signal that includes features your product, then test one that does not feature your product.

  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.