1

Is there any way to skip SMS sends for a current subscriber and move on to the next subscriber? I tried with the RaiseError AMPScript function but it is not working for MobileConnect messages.

Updated:

%%[
SET @Data = LookupRows("MYDE","MobileNumber",MOBILE_NUMBER)
    IF RowCount(@Data) > 0 Then
     some codes.....
    Else
      RaiseError("Do not send to subscriber", true)
    EndIF
]%%
5
  • Can you please paste a copy of your code?
    – 0xsegfault
    Aug 1, 2017 at 5:32
  • I added my code.
    – MC Coder
    Aug 1, 2017 at 5:51
  • Have you tried Declaring @ Data eg var @ Data ?
    – 0xsegfault
    Aug 1, 2017 at 5:54
  • That's not required :)
    – MC Coder
    Aug 1, 2017 at 6:11
  • Saving you alot of time by advising you to always declare it ;)
    – 0xsegfault
    Aug 2, 2017 at 13:41

2 Answers 2

2

The AMPscript RaiseError function only works for email sends. However, I have found a solution for you.

MobileConnect will not send an empty SMS message. So you can use the following code in your message template:

%%[
var @Data
set @Data = LookupRows("MYDE","MobileNumber",MOBILE_NUMBER)
if RowCount(@Data) > 0 then 
]%%
insert SMS message here
%%[ endif ]%%

This works; if the if test evaluates to false, then the message is empty and is not sent to the mobile subscriber.

4
  • Great found! I used Journey to solved my issue :)
    – MC Coder
    Aug 9, 2017 at 11:37
  • Does using this trick still count as a send from a billing perspective? Oct 5, 2017 at 14:35
  • @eliot RaiseError now supports in MobileConnect. I have tested it. Jul 31, 2018 at 3:10
  • @BradSapkota, I'm not convinced this does work with SMS. I believe what you are experiencing is that the SMS is erroring as the AMPscript RaiseError function is not supported by MobileConnect, so in short, you could use it (or any other unsupported function) to 'break' the send to a Contact, but this is not best practice. If I have missed something and you have used it to cancel an entire send and also validated the scenario to skip sending to a Contact (by adding the second parameter), then please do let me know. Feb 15, 2019 at 21:06
2

Nowadays for February 2020 I am using RaiseError with Journeys, Content Builder, and MobileConnect and is working right, sending or not sending based on the IF.

You must log in to answer this question.

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