Loading

Create Exclusion Script for use in Journey Builder Email Activity

Дата публикации: Apr 30, 2026
Описание
While designing a Journey, you may want to exclude a subset of your Entry Audience population from one or more Email Activities for various reasons. A common reason to exclude a contact is because the contact is currently active in a separate Journey.
Решение

When needing to exclude records from your Entry Audience you can follow the below configuration:

  • While configuring an Email Activity you will reach a tab which correlates to this document Manage Contacts.
  • The exclusion script section will allow for AMPscript to be added so records who return a true value ( a 1 in boolean terms ) are excluded from the send without needing to be added to a Suppression List. 
  • To use Journey Data from the data extension entry source in your exclusion script, use the AttributeValue function. You can also use Personalization Strings to access subscriber data for subscribers already existing in All Subscribers, however Personalization Strings cannot access Journey Data in an exclusion script.
  • Should you wish to use data from a Data Extension in your Exclusion Script, we'd recommend using a Code Snippet and calling the Code Snippet using one of the following

Examples:

1. Basic script checking if email address exists in a referenced data extension: 

ROWCOUNT(LOOKUPROWS("Exclusion_DATA_EXTENSION_NAME","EMAIL_ADDR_FIELD_NAME", EMAILADDR))>0


In this example, the 'Exclusion_Data_Extension_Name' contains a field titled 'Email_Addr_Field_Name' and this field contains email address values. The Personalization String 'emailaddr' captures the subscribers email address who is being rendered for the send. This will be determined by your Default Email Address within the Journey. If your subscriber email address can be matched to an 'Email_addr_field_name' value in the 'Exclusion_Data_Extension_name' data extension, then a value of 1 is returned through the RowCount(LookUpRows()) functions. 

Since 1 is greater than 0, the contact would return a value of true and your contact would be excluded from the send. 

2. Exclusion script using OR condition to check multiple data extensions:

(ROWCOUNT(LOOKUPROWS("Exclusion_DATA_EXTENSION_NAME_1", "EMAIL_ADDR_FIELD_NAME", EMAILADDR)) > 0)

OR

(ROWCOUNT(LOOKUPROWS("Exclusion_DATA_EXTENSION_NAME_2", "EMAIL_ADDR_FIELD_NAME", EMAILADDR)) > 0)


3. Exclusion script that that uses AMPscript in a Code Snippet:

The following code is added to a Code Snippet in Content Builder:​​​​​​

%%[
set @count = ROWCOUNT(LOOKUPROWS("Exclusion_DATA_EXTENSION_NAME","EMAIL_ADDR_FIELD_NAME", EMAILADDR))
]%%
%%=v(@count)=%%

The following exclusion script is then used to output the result from the Code Snippet:

ContentBlockbyId("CODE_SNIPPET_ID") > 0


Caution: Complex filters and/or filters on large tables can cause slow send speeds. Best practice is to pre-filter these subscribers before injecting them into the journey in question. If that cannot be achieved, suppression lists would be a preferred alternate to complex exclusion scripts. 
 

Note: Exclusion Script may not be available as an option within the Email Activity. If this is the case, please reach out to Marketing Cloud Support to enable this feature.

Номер статьи базы знаний

000384149

 
Загрузка
Salesforce Help | Article