We have registration and Thank you cloud page. I'm currently inserting records from Thank you(processing) cloud page to DE using AMPSCRIPT. Mobile Number/Email address is primary key, I need to display error message in registration page if record is already exist. I'm new to SFMC, kindly help me on this issue.

  • Please do not create duplicate accounts.
    – Adrian Larson
    Commented Aug 21, 2018 at 6:27
  • My bad, accidentally I have created it.
    – Bharath
    Commented Aug 21, 2018 at 7:48

1 Answer 1


You have to use different Ampscript functions to accomplish this.

First use lookupRows to check if the emailaddress/subscriberkey exists in your data extension. RowCount gives the count of matching rows. If rowcount is more than 1, then use RaiseError to display an error message


var @result = RowCount(LookupRows('PostalCode','City','Indianapolis'))

if @result = '0' then {
  /*do you action*/
  ouput(concat("All good"))
  raiseError("Error raised")

  • Thanks for your input. Can I validate this without redirecting to "thank you page"? Currently all my AMPSCRIPT is in "thank you page". If record is already exists, it should display error message in Registration page itself without redirecting to "thank you page".
    – Bharath
    Commented Aug 21, 2018 at 7:47
  • Yes, you can do the same coding on the registration page.
    – sfdcFanBoy
    Commented Aug 21, 2018 at 7:52
  • 1
    To expand, you can use the conditional to decide your content. E.g. if result = 0 then display thank you html, else display you have already submitted html. I do not recommend raiseError in a LP, it is poor customer experience to display the SFMC error page to them. Commented Aug 21, 2018 at 12:39

You must log in to answer this question.

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