Though a strange request, we're not asking the 'why' but the 'how' ...

We have a situation where a marketer is sending an email from Marketing Cloud to a Salesforce (Salescloud) report, using Marketing Cloud Connect.

During the send configuration process, they marketer isn't informed how many records are on the Salesforce Report they are about to send to.

Ultimately what has happened (due to wider permissions issues in Salesforce) - the marketer sends to a 'filtered' report without the correct filters working and therefore sends the email to a much larger audience than they had anticipated.

What we'd like to do is add in a fail-safe, that should the Salesforce Report have greater than 1000 records, then cancel the send (i.e. prevent the send from going to the incorrect audience).

We've thought about adding AMPScript to the Email / Template (below) but we have some caveats with this across the organisation - i.e. marketers could copy an existing email rather than creating from New Template etc

if _isTestSend == False then
Var @rcount, @finalcount
Set @rcount = __DataSourceName
set @finalcount = DataExtensionRowCount(@rcount)
If @finalcount >=1000 
RaiseError("Subscriber Count Limited Reached",False)


Do you have any thoughts / suggestions of how we could enable something Business Unit wide that would fail a send if over a threshold?


I'd definitely do this with an Exclusion Script on the Send Defintion instead of using RaiseError(). Something like this, perhaps:

_isTestSend == false and DataExtensionRowCount(AttributeValue("_DataSourceName")) > 100

You still get billed for sends even if you stop them with RaiseError().

Your script wouldn't work for sends to lists, if that matters.

(Also, you have an extra underscore in front of _DataSourceName in your example.)

  • Thanks Adam, - yep we too contemplated exclusion scripts but it's again reliant on someone adding it manually. We were/are hoping for some sort of business unit level setting that we can apply as administrator rather than relying on marketer to add it (they fail to check the audience size on the report, so can't trust they will remember to add an exclusion script).
    – Gravitai
    Mar 23 '18 at 11:36

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.