I wish to add exclusion script to one of my email. Since my exclusion script is more than 1 line, I have created a Content Block in my same email. I am following the steps given in this pagehttps://sfmcjourney.com/exclusion-script-explained/ (5th point given here). This is how my code looks like now

set @incomingEmail=AttributeValue("emailaddress") 
set @incomingpid=AttributeValue("pid") 
set @finalValue=rowcount(Lookuprows("Exclusion_DE","EmailAddress",@incomingEmail,"pid",@incomingpid))>0


Then one line of exclusion code is added in email configuration:

TreatAsContent(ContentBlockbyID(‘[ID_OF_CONTENT_BLOCK]’)) > 0

I am a bit confused and have the following questions,

  1. I have created the content block and added it within the email. Should the content block be added within the email itself or should that be done outside the email and not be part of the email?

  2. 2nd part of the code with a single line(i,e TreatAsContent, I am not able to understand what it exactly does?)

Any help is appreciated.

  • 3
    Exclusion script conditionals must return true or false, not a numeric value. Aug 14, 2021 at 15:11

1 Answer 1


The content block doesn’t need to be part of the email. You don’t need to add it anywhere as it will be referenced in the Exclusion Script. The way you’re doing it is fine, given you actually put the ID of the content block into the [ID_OF_CONTENT_BLOCK] placeholder, eg:

TreatAsContent(ContentBlockbyID(123)) > 0

Now as for the script you wrote, it won’t work that way - the syntax you’re using to set the@finalValue variable is incorrect. Since your script seems quite simple, you could try to include it directly in the exclusion script box without using the content block at all:

rowcount(Lookuprows("Exclusion_DE","EmailAddress", AttributeValue("emailaddress"),"pid", AttributeValue("pid")))>0

That way if the rowcount of records matched in the DE for a subscriber is greater than 0, the above line of script will return the value true and suppress the send for that subscriber. If the value of rowcount is 0, it will return the value false and it will send the email to that subscriber.

It’s explained quite clearly in the blog post you mentioned, so I suggest going through it once again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .