Created the Smart capture form using Cloud page and submitting the data into the Data Extension. Now, I want to restrict the cloud page data submit up to 50 record for per campaign send. Example: I send out 200 email with cloud page url CTA so, only first 50 records should be able to submit the form and remaining should redirect to Contest closure page.

So can we do this using amp script? If yes, the can any one help with some reference document or way to do this?

Thank you in advance!

1 Answer 1


You will need a custom form instead of Smart Capture, as you will need to build following logic:

  1. The CTA in the email should utilise CloudPagesUrl function, which will pass a.o. jobid to the landing page.
  2. A hidden input field, which holds the jobid passed from the email - this should be populated using %%=AttributeValue(jobid)=%%. Your destination Data Extension should also have this numerical field present.
  3. Once the form gets submitted, this hidden field will be passed to your data extension, along with the remaining form fields.
  4. To limit the number of your submissions, you will need to wrap the smartcapture block with two code snippets. The top:
SET @job = AttributeValue(jobid)
SET @rows = RowCount(LookupRows("FormSubmissions","jobid", @job))
IF @rows < 51 THEN

The bottom:


This will only display the form if less than 51 submissions happened from that particular sendjob, otherwise the visitor will be redirected to the cloud page ID 55555, which will display Contest closure page.

  • It worked perfect. Thanks alot! Feb 10, 2022 at 16:03
  • I am passing the Jobid in the thankyou url 'set @FormURL = Concat("URL?jobid=", @jobid)' Is there any way to encrypt the Jobid from the url? as the Job id is seen in the url. Feb 10, 2022 at 16:03
  • If you use CloudPagesUrl function to build your email link, it will be automatically appended and encrypted, as per: salesforce.stackexchange.com/questions/262553/… Feb 10, 2022 at 18:21

You must log in to answer this question.

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