I'm trying to create an exclusion script based on the output of a Code snippet which looks like:

<script language="javascript" runat="server"> 
Platform.Load("core", "1");

var AttributesJsonJs = Platform.Function.ParseJSON(Variable.GetValue("@AttributesJsonDE"));

} else {


%%[ VAR @canSendEmail IF @sendEmail == "true" THEN SET @canSendEmail = "canSendEmail" ELSE SET @canSendEmail = "dontSendEmail" ENDIF ]%%


My exclusion script looks like:


When I make a call to send the triggered send I can see the queue being filled, however nothing is being send, even if the output doesn't match the exclusion script. Any ideas on what I'm doing wrong?

Thanks a lot!

Update DE Record This is the record information for the column Attributes


I've also tried the following:

var @str, @var, @sendEmail

/* Set the value to check */ 
SET @var = false

/* Set the string to check */ 
Set @str = AttributeValue(sendEmail)

/* Does it match */ 
if IndexOf(@str,@var) > 0 then 
    Set @sendEmail = "dontSendReceipt" 
    Set @sendEmail = "sendReceipt" 


When testing the email in preview and test the correct value is being populated. My exclusion script looks now like this:

TreatAsContent(ContentBlockbyID('127567')) == dontSendReceipt

But still no luck..

  • If you remove the script from your send definition and add it to your email body, what does it show? Mar 16, 2021 at 18:59
  • Hi @AdamSpriggs, it shows canSendEmail, which is correct Mar 16, 2021 at 19:19
  • And if you capture the RequestID from your Triggered Send API call and retrieve the delivery details using the /messaging/v1/messageDefinitionSends/key:{{TSDKey}}/deliveryRecords/{{RequestID}} REST route what do you get? Mar 16, 2021 at 23:31
  • @AdamSpriggs, It says it's being queued. When I check the email that is being generated the code gives me the output that I need to be able to send the email, however nothing is happening Mar 17, 2021 at 7:04
  • If it doesn't get sent -- the deliveryRecord result should show something once it gets past "queued". Mar 17, 2021 at 11:59

1 Answer 1


After multiple different solutions, I've decided to go for the RaiseError function. The exclusion will not happen too many times, so this should be sufficient enough.

You must log in to answer this question.

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