0

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.

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

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"))
}
else{
  raiseError("Error raised")
}
endif

]%%
3
  • 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 Aug 21 '18 at 7:47
  • Yes, you can do the same coding on the registration page. – sfdcFanBoy Aug 21 '18 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. – Gortonington Aug 21 '18 at 12:39

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.