Loading...

Automating messaging consent in Salesforce is essential for maintaining compliance and scaling customer communication. In this guide, you’ll learn how to auto-create OPT-IN Messaging Consent records using a Record-Triggered Flow, eliminating manual work while ensuring accurate, real-time consent capture.

If you’re searching for a reliable way to automate consent tracking in Salesforce without Apex and make your org compliance-ready, this guide walks you through the exact architecture and implementation.

Consent management is a critical component of modern CRM systems, especially when working with:

  • Marketing Cloud Growth 
  • Data Cloud 
  • GDPR / CAN-SPAM compliance requirements 
  • Automated subscription management

Here’s how to build a Record-Triggered Flow on Contact that automatically creates a Messaging Consent record when a new Contact is created.

This solution ensures:

✔ Automated consent creation

✔ Compliance-ready configuration

✔ Scalable architecture

✔ No manual intervention

We’ll break down every element of the flow and explain what it does and why it’s needed.

Flow Architecture Overview

Flow Type:

Record-Triggered Flow

Object:

Contact

Trigger:

When a record is created

Optimize For:

Actions and Related Records

Step 1: Record-Triggered Flow Configuration

 

Step 1


Why Use Record-Triggered Flow?

We want consent automation to happen:

  • Immediately when a Contact is created 
  • Without manual clicks 
  • In a scalable and maintainable way 

Using a Record-Triggered Flow ensures:

  • Automatic execution 
  • No dependency on Apex 
  • Admin-manageable logic

Step 2: Decision Element – “Check Email Present”

Step 2 1

What This Does?

This decision checks the following:

Is email populated?

If:

  • Email exists → proceed 
  • Email is blank → end flow 

Why This Is Important?

Creating Messaging Consent without an email makes no business sense because:

  • Consent is tied to a communication channel 
  • Email is required as a contact point 
  • MessagingConsent requires ContactPointValue 

This protects:

  • Data quality 
  • Compliance accuracy 
  • System integrity 

Step 3: Get Created Contact

 

Step 3


What Does This Do?

Fetches the newly created Contact record again.

Why Not Just Use $Record?

Although $Record contains data, sometimes we explicitly fetch the record to:

  • Ensure latest committed data 
  • Access related fields safely 
  • Keep architecture structured for expansion 

This is especially useful if future logic grows.

Step 4: Get Email Engagement Type

Step 4 1


What This Does

Retrieves the Engagement Channel Type for Email.

This likely queries:

  • Communication Subscription Channel Type 
  • Email-related engagement configuration

Why This Is Required

Messaging Consent requires:

CommunicationSubscriptionChannelType

Without this:

  • Consent record cannot be created 
  • System doesn’t know which channel to apply consent to

This step identifies:

Which communication channel are we creating consent for?

Step 5: Get Subscription Id

Step 5


What This Does

Retrieves the relevant subscription records associated with the communication type.

Why This Step Is Critical

A single Contact may have:

  • Multiple subscription types 
  • Multiple marketing programs 
  • Multiple communication channels 

Instead of hardcoding a single ID, we dynamically fetch:

✔ All relevant subscriptions

✔ Make the solution scalable

This prevents future maintenance issues.

Step 6: Loop Element (Loop 1)

Step 6


What This Does

Loops through the collection of subscription records retrieved earlier.

Why Use a Loop?

Because:

  • There may be multiple subscription IDs 
  • Consent must be created for each subscription 
  • Hardcoding would break scalability

Loop allows:

✔ Dynamic processing

✔ Bulk-safe design

✔ Enterprise-grade flexibility

Step 7: Messaging Consent Creation – Exact Implementation (As Configured in This Flow)

After retrieving the required subscription records and looping through them, we use the standard Salesforce action:

MessagingConsentV2.MessagingConsent

This action is responsible for creating a Messaging Consent record for each subscription associated with the Contact.

Below is the exact configuration used in this flow.

Step 7


Formula Resource Created: ConsentId

Before configuring the Messaging Consent action, a Formula Resource was created.

Resource Name:

ConsentId

Data Type:

Text

Formula:

{!$Record.Email} & “#” & {!Loop_1.Id}

Why This Formula Is Used

This formula dynamically generates a unique identifier by combining:

  • The Contact’s Email 
  • The Subscription Id from the Loop

Example output:

john.doe@email.com#0XlPs00000000XtKAI

Why This Matters

This ensures:

  • Each consent record is uniquely identifiable. 
  • No duplicate consent creation for the same email + subscription. 
  • Proper traceability for compliance.

This is an important design decision to maintain uniqueness in consent records.

MessagingConsentV2.MessagingConsent – Field Configuration

Now let’s break down the exact field mappings configured in the action.

CommunicationSubscriptionChannelType

Mapped Value:

Communication Subscription Channel Type ID

This value comes from the Get Records step that retrieves the subscription channel type.

Purpose:

This identifies which communication channel (Email in this case) the consent belongs to.

Without this, Salesforce cannot associate the consent with the correct subscription channel.

ConsentCapturedDateTime

Mapped Value:

Running Flow Interview → CurrentDateTime

Purpose

Records the exact timestamp when consent is captured.

This is essential for:

  • Audit tracking 
  • Compliance validation 
  • Legal reporting requirements

ConsentId

Mapped Value:

ConsentId (Formula Resource)

Purpose

Uses the dynamically generated composite key:

Email + “#” + SubscriptionId

This guarantees uniqueness for each consent record.

ConsentStatus

Value:

OPT_IN

Purpose

Defines the contact’s consent status.

In this implementation:

Every new Contact with an email is automatically marked as OPT_IN for the relevant subscription.

ContactPointValue

Mapped Value:

Triggering Contact → Email

Purpose

Defines the actual communication value of the consent.

Since this is an email-based consent:

  • The Contact’s Email field is used as the contact point.

UpdatedTime

Mapped Value:

Running Flow Interview → CurrentDateTime

Purpose

Ensures that:

  • The consent record has a proper last updated timestamp. 
  • The record remains audit-compliant.Updated Time


Note:
In this implementation:

  • PartyId was not included in the action.
  • ConsentCapturedSourceName was not included.
  • ConsentCapturedSourceType was not included. 

Only the required and relevant fields were mapped based on your actual configuration.

How the Loop Works in This Architecture

  1. Get Subscription Id retrieves all relevant subscription records. 
  2. Loop 1 iterates through each subscription. 
  3. For each subscription: 
    • A unique ConsentId is generated. 
    • MessagingConsentV2.MessagingConsent action is executed. 
  4. The flow completes after processing all subscriptions.

This ensures scalability and supports multiple subscription records per Contact.

By implementing this flow-based approach, you can streamline consent management, improve data accuracy, and stay compliance-ready without using Apex. It’s a scalable, no-code solution for managing OPT-IN consent efficiently in Salesforce.

No Data Found.

Related Articles
Fetch Document from Niko Health and Attach it to Salesforce Account

Integrating external healthcare platforms like Niko Health with Salesforce helps streamline document management and improve operational efficiency. In this guide, we will walk through the complete process of fetching a document from Niko Health using APIs and attaching it to a Salesforce account as a file. This step-by-step implementation is useful when you want to […]

Read More
Winter 26 Update Using LWC as Local Actions in Screen Flows

The Salesforce Winter Release 2026 introduces powerful AI-driven updates focused on automation, productivity, and smarter CRM experiences. From major enhancements in Salesforce LWC to improved Salesforce Flow local action capabilities, the release helps developers and admins build faster, more scalable Salesforce solutions. The Salesforce Winter 26 release also reflects Salesforce’s growing focus on AI-powered workflows, […]

Read More
Automation Difference Between HubSpot and Salesforce Flow

Customer Relationship Management (CRM) systems help businesses manage customer interactions, sales processes, and marketing campaigns efficiently. Two of the most popular CRM platforms used worldwide are HubSpot and Salesforce. Both platforms provide automation tools that allow businesses to automate repetitive tasks, improve efficiency, and reduce manual work. However, the automation capabilities and design of these […]

Read More
Automating Customer Approval Using Salesforce Approval Process

In many financial or compliance-based applications, organizations need a structured way to review and approve important documents or financial data before they are finalized. For example, a company implemented a Salesforce approval process to validate Customer’s ITR (Income Tax Return) details to ensure that high-income cases are reviewed by senior authorities while keeping the process […]

Read More
How We Built a Structured Prospecting System Using HubSpot’s Prospecting Agent

Outbound prospecting doesn’t fail due to lack of effort, it breaks down when there is no structured system behind it. Many teams either rely heavily on manual outreach or expect automation tools to handle the entire process, often leading to inconsistent results and low-quality engagement. At HIC, we take a more balanced and scalable approach. […]

Read More
Apollo to HubSpot Integration Sync Contacts and Companies

Apollo is one of the most powerful prospecting tools for finding verified contacts and company information. HubSpot is a leading CRM used to manage contacts, companies, deals, and sales activity. When we integrate Apollo with HubSpot, we can automatically sync new prospects into HubSpot, along with enriched data like email, phone number, job title, and […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203239658
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818