Consent Tracking Specific Accounts in Community Hub

If your association complies with various data protection and privacy regulations, you may need to ask only specific constituents to provide consent. This recipe serves as one example of how you might display a marketing consent alert only to residents in certain European countries, with a button to provide consent.

Recipe Prep

Keep these things in mind:

To make this recipe, you should understand:

Ingredients

You will mix these ingredients together to make this recipe:

Name Type Description
MarketingConsentProvided

Flow

In Community Hub, this flow is run when a logged in constituent clicks the Marketing Consent Provided button, which passes an SObject collection variable of accounts into the flow. The flow loops through this SObject collection variable—which, in this recipe, only contains one account record—and updates the value of marketing consent fields on the account record.

CurrentAccountId Query Queries the account ID of the constituent currently logged into Community Hub.
CurrentAccountId Data Source Passes the CurrentAccountId query to the Marketing Consent Provided button.
Marketing Consent Provided Button In Community Hub, logged in constituents click this button to run the MarketingConsentProvided flow.
Marketing Consent Required Access Control References a formula field on the logged in constituent's account record to determine if the Marketing Consent Alert card should display.
Marketing Consent Alert Card In Community Hub, this card displays a message and the Marketing Consent Provided button to logged in constituents.

Directions

Create Custom Consent Fields

Custom consent fields track whether constituents have consented to having their data used for marketing purposes.

  1. Create the following custom fields on the Contact object:

    Field Label Suggested API Name Field Type Description
    Consented to Marketing ConsentedToMarketing Checkbox If true, the constituent has consented to having their data used for marketing purposes.
    Last Consented to Marketing Date LastConsentedToMarketingDate Date The date the constituent either gave or did not give consent to having their data used for marketing purposes.

Create an Autolaunched Flow and Button to Run the Flow

  1. Using Cloud Flow Designer, create the MarketingConsentProvided flow:
    1. Create SObject resources with the following values:

      Resource Type Unique Name Input/Output Type Object Type Description
      SObject Collection Variable InputSObjects Input Only Account The account records passed in as inputs from the Marketing Consent Provided button.
      SObject Variable CurrentAccount Private Account The current iteration in the loop through the InputSObjects SObject collection variable.
      SObject Collection Variable AccountsToUpdate Private Account The temporary SObject where the loop stores the updated marketing consent field values.
    2. Create a Formula resource with the following values:

      Resource Type Unique Name Value Data Type Formula Description
      Formula Today Date TODAY() Returns today's date.
    3. Create a Loop element named "Loop Thru InputSObjects" with the following values:

      Loop through Loop Variable Description
      {!InputSObjects}
      {!CurrentAccount} Loops through the InputSObjects variable.
    4. Create an Assignment element named "Update Consent Fields" that performs the following assignments:

      Variable Operator Value Description
      {!CurrentAccount.LastConsentedToMarketingDate__pc} equals {!Today} Sets Last Consented to Marketing Date to today's date.
      {!CurrentAccount.ConsentedToMarketing__pc} equals {!$GlobalConstant.True} Sets Consented to Marketing to true.
    5. Create an Assignment element named "Add to AccountsToUpdate" that performs the following assignment:

      Variable Operator Value Description
      {!AccountsToUpdate}
      add {!CurrentAccount} Adds the CurrentAccount variable (with its updated consent values) to the temporary AccountsToUpdate SObject collection variable.
    6. Create a Fast Update element named "Update Accounts" that performs the following assignment:

      Variable
      {!AccountsToUpdate}
    7. Set the Loop Thru InputSObjects element as the Start element.
    8. Connect the elements:
      1. "Loop Thru InputSObjects" goes to "Update Consent Fields" for each value in the collection.
      2. "Update Consent Fields," goes to "Add to AccountsToUpdate."
      3. "Add to AccountsToUpdate," goes to "Loop Thru InputSObjects."
      4. "Loop Thru InputSobjects" goes to "Update Accounts" when there are no more values to process.
        Show Me an Image...

    9. Save the flow with with the following values and then activate it.

      Name Unique Name Type
      MarketingConsentProvided MarketingConsentProvided Autolaunched Flow
  2. Create the CurrentAccountId query with the following values:

    Field Value
    Query Name CurrentAccountId
    SELECT Id


    SObject Account
    WHERE Id = {!CurrentAccountId}
    Sharing Mode User
  3. Create the CurrentAccountId data source with the following values:

    Field Value
    Name CurrentAccountId
    Class

    SOQLDataSource

    Context CurrentAccountId
  4. Create the Marketing Consent Provided button with the following values:

    Field Value
    Name Marketing Consent Provided
    Class

    NC.DynamicFlowButton

    Heading Label I Consent
    Object Account
    Data Source CurrentAccountId
    Configuration MarketingConsentProvided

Create a Card with an Access Control

Before creating an access control, a formula field is required to contain the logic that determines which logged in constituents should see the card.

  1. Create a Marketing Consent Required account field with the Formula (Text) data type. When the formula is true, the Marketing Consent Alert card displays. Consider which constituents should see the card and when.
    For example, this formula results in a card that displays only to Italian or French constituents who have never consented to marketing or who have not consented to marketing in the last 365 days (for an association that has set their Consent Request Frequency Privacy Setting set to 365):

    AND(
      OR(
        PersonMailingCountry = 'Italy',
        PersonMailingCountry = 'France'),
      OR(
        ISBLANK(LastConsentedToMarketingDate__pc),
        TODAY() - $Setup.PrivacySettings__c.ConsentRequestFrequency__c > LastConsentedToMarketingDate__pc)
    )

    If you need to specify several countries, it may be easier to offload that logic onto a query record and use the SOQL "IN" notation. For example: WHERE PersonMailingCountry IN ('Country 1', 'Country 2', 'Country n').

    Yet another option is to use the VLOOKUP function (external) in the formula, particularly if you want to track the country list more formally in a custom object.

  2. Create the Marketing Consent Required access control with the following values:

    Field Value
    Name Marketing Consent Required
    Class AccountConditional (NC)
    Query Record Name Marketing Consent Required
    Is Active TRUE
  3. Create the Marketing Consent Alert card with the following values:

    Field Value
    Type Plain Text
    Name Marketing Consent Alert
    Access Control Marketing Consent Required
    CSS Class m-card-as-alert alert-info
    Heading Label Marketing Consent
    Description Label I have read and I agree to the privacy policy, and understand how the association uses my data for marketing purposes.
    Button Marketing Consent Provided

    If you want to include HTML tags in the Description Label, such as a link to your privacy policy, set the Card Layout to Display HTML.

This is just one way you can set up consent tracking for specific accounts in Community Hub. You can create your own components to customize the experience for your constituents, just be sure that whatever approach you take complies with the data protection and privacy regulation(s) to which you are adhering.

This recipe only created the button and flow for a constituent that provides consent. You would generally want to provide a separate button and flow so constituents can decline providing consent. The button could be added to the Marketing Consent Alert card alongside the Marketing Consent Provided button.

On This Page

In This Section