Skip to main content

Prerequisites for Salesforce Notifications using SalesWings Data.

To get started with Notifications in Salesforce using SalesWings Data, you must start with an Alerter Subflow.

Desmond Wolkins avatar
Written by Desmond Wolkins
Updated over a month ago

The Alerter Subflow

Summary

The Alerter Subflow is a reusable subflow designed to handle all email and notification alerts.
By creating a single, centralized flow for alerting, you can ensure consistency across automation processes and reduce duplication. Other flows can easily invoke this subflow by providing the required input variables.


Objective

To create an Autolaunched Flow that can send either an email or a notification, depending on the input provided.


Before You Begin

Make sure you have the following:

  • Permission to create and modify Flows in Salesforce.

  • Access to create or reference a Custom Notification Type (for notifications).


Step 1: Create an Autolaunched Flow

  1. From Setup, navigate to
    Process Automation → Flows → New Flow.

  2. Select Autolaunched Flow (no trigger) and click Create.


Step 2: Define the Variables

Input Variables (Available for Input)

Create the following variables to make them available for other flows to populate:

Variable Name

Data Type

Description

recipientIds

Text (Collection)

List of User IDs to receive the alert

body

Text

The content or message body

subject

Text

The subject line for the alert

targetId

Text

The related record ID (optional)

type

Text

Determines the alert type (email or notification)

Internal Variable

Create the following internal variable (not available for input):

Variable Name

Data Type

Description

recipientsEmailAsText

Text

Used internally to store email addresses in text format

Tip: Name your flow descriptively — for example, Alerter or Send Alert Subflow.


Step 3: Add a Decision Element

  1. Add a Decision element to the flow and name it Determine Alert Type.

  2. Configure it to evaluate the type variable:

    • If type = email → Go to the Email Branch.

    • If type = notification → Go to the Notification Branch.

The decision block, which checks for the type variable value, email or notification


Step 4: Configure the Email Branch

When the alert type is email, the subflow must translate User IDs into email addresses, since email delivery requires explicit addresses.

  1. Get Records:

    • Add a Get Records element to retrieve User records where the ID is in recipientIds.

    • Store all returned record

  2. Loop Through Users:

  • Add a Loop element to iterate through the retrieved user records.

  1. Assign Email Addresses:

    • Inside the loop, create an Assignment element.

    • Concatenate each user’s email address into the recipientsEmailAsText variable, separated by commas.

      recipientsEmailAsText = recipientsEmailAsText + currentUser.Email + ","

  2. Send Email:

    • Add a Send Email element.

    • Populate it with the following variables:

      • To Address: recipientsEmailAsText

      • Subject: subject

      • Body: body

      • Related Record ID: targetId

Tip: You can enhance this branch later by adding rich text support or including templates.


Step 5: Configure the Notification Branch

To send a notification, you first need a Custom Notification Type.

  1. Create the Custom Notification Type:

    • Navigate to Setup → Notification Builder → Custom Notifications.

    • Click New, define the notification, and note the Developer Name.

  2. Retrieve the Notification Type:

    • Add a Get Records element to retrieve the Custom Notification Type by its Developer Name.

    • Store only the ID field.

  3. Send Notification:

    • Add a Send Notification element and populate it with:

      • Notification Type ID: From the Get Records element

      • Recipient IDs: recipientIds

      • Title / Message: subject and body

      • Target Record: targetI


Step 6: Save and Activate the Flow

  1. Click Save and give your flow a clear name (e.g., Alerter_Subflow).

  2. Click Activate to make the subflow available for other flows to call.


Result

You now have a fully functional Alerter Subflow that can:

  • Send emails by converting recipient IDs to addresses, or

  • Send notifications through Salesforce’s in-app system.

Other flows can now call this subflow by passing in the appropriate variables, streamlining how alerts are sent across your org.

This is what your diagram should look like:


Related Resources


Have any questions or concerns? Feel free to reach out to your Customer Success Manager!

Did this answer your question?