I built a for using SmartCapture in a CloudPage where the customers can access from the link in an email. Once the customer fulfils it an click on 'Submit, I would like to store the SubscriberKey in a field of the Data Extension and, (in case the subscriberkey is already there), overwrite the line.

How can it be done? Is it possible to add AMPScript code in the Submit button?

  • Are you not using the attributes from Data extension in the SmartCapture?
    – Akash R
    Jun 24 '20 at 13:52
  • yes, but how can I store the subscriberkey in the field of that Data Extension? That value is not displayed in the form but retrieved from the email once the customer clicks on the cloudpage link.
    – fromero
    Jun 24 '20 at 13:55
  1. Within your email, include the email address of the subscriber along with the Cloudpage URL, example, "https://example.com?SubscriberKey=%%emailaddr%%"
  2. Include a field from the DE say, 'SubscriberKey' in the Hidden Field attribute of the Smart Capture Form
  3. Include the below AMPscript in the Code View tab of the cloudpage. RequestParameter is used to retrieve the value.
        var @subs
        set @subs = RequestParameter("SubscriberKey")
  1. Include the variable as the value in the HTML editor, within the form tag
    <input name="SubscriberKey" type="hidden" value="%%=v(@subs)=%%"/>
  1. Once the form is submitted, the value will be captured in your DE

    You can then use this hidden variable to check if the email address is already in the DE and upsert accordingly.

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.