Existing registrant should not be able to proceed when clicking 'ENTER' and have the following error message (in red) display below the Email Address field: Oops! This email address has already entered the competition. can u guide me on this requiremnet

  • 3
    Hello @shiva D N! Welcome to SFSE, can you please provide some more info, including use case, good faith attempts you have used and any current code you have for your question. See here for advice on how to ask a question: salesforce.stackexchange.com/help/how-to-ask – Gortonington Aug 9 at 2:21

Taking a stab in the dark and assuming this is hosted on a cloud page, here is what I would do:

  1. Have the page post to itself
  2. Have a lookup inside AMPScript to see if the emailaddress already exists in your DE
  3. Have a conditional to display error text if already exists or to do an AMPScript insert if it does not and display success content.

To post to itself:

<form action="yourCloudPageURL" >

Example Lookup:

%%[
   /* Assuming the input name is 'EmailAddress'
      This will pull the input value into AMPScript */
   SET @EmailAddress = RequestParameter("EmailAddress")

   /* This will check to see if the email address exists in DE */
   SET @Lookup = LOOKUPROWS('yourDE', 'EmailAddress", @EmailAddress)

]%%

Example Conditional:

%%[ IF ROWCOUNT(@Lookup) == 1 THEN 

   InsertData('yourDE','EmailAddress',@EmailAddress)

]%%

   <p style="color:green">Thank you for entering our competition!</p>

%%[ ELSE ]%%

   <p style="color:red">Oops! This email address has already entered the competition.</p>

%%[ ENDIF ]%%

You can also use this conditional logic to show/hide the form after submission to help prevent accidental double submissions.

Please be aware this would require a full form submission and a page refresh on every entry as all the logic is on the server side. I recommend this over a client side Javascript solution as many of those can potentially open a security risk to your SFMC data.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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