1

I have an email where if the join to the content Data Extension produces no record, I don't want to send to that email address.

is there any way through ampscript to error off that record and not include it in the send?

example:

%%[
    SET @contentRowset = lookuprows("HR_ContentTable","template",@template,"subnum",@subnum)
    if rowcount(@contentRowset) > 0 then
        SET @contentRow = row(@contentRowset,1)
        Set @subline = field(@contentRow,"subline")
    else
        ERROR THE RECORD SOME HOW
    endif
]%%

2 Answers 2

2

Yes, RaiseError(). http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/api_ampscript_functions/#RaiseError

%%[ 
SET @contentRowset = lookuprows("HR_ContentTable","template",@template,"subnum",@subnum) 
if rowcount(@contentRowset) > 0 then 
    SET @contentRow = row(@contentRowset,1) 
    Set @subline = field(@contentRow,"subline") 
else 
    RaiseError("ERROR THE RECORD SOME HOW",true)
endif
]%%

'True' will skip that email in the send, 'False' will cancel the job.

0

If you don't want to "munch a send" you can use an Exclusion Script in the User-Initiated Send Definition. You still get charged for a send if you use raiseError(). SFMC Support can enable the Exclusion Script box if it doesn't show on the UI Send Def page.

Exclusion Script

NOTE: The exclusion script must evaluate to True or False like this:

rowcount(lookuprows("LOOKUP_DATA_EXTENSION", "EmailAddress", emailaddr)) > 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.