Marketing Cloud Lead Submission (Part 1)

Marketing Cloud Lead Submission (Part 1)

Corey Trick  |  March 7, 2018

For many single landing page solutions, the primary goal is generating leads. In this two-part blog series, we will share a process to capture those leads, using AMPScript through Salesforce Marketing Cloud, and then add users to a campaign. AMPScript as a language allows for some great customization options in user experience, plus it’s a powerful way to manipulate the data you send to Salesforce. This series will scratch the surface on how to use some of that user data from Salesforce to customize your submission.

Example Form: How It Works in Action

For the example form below, we will be using custom variables and then syncing to Salesforce fields within a CreateSalesforceObject function. The main item to note is the form action and how the form is being processed. The form submits back to the page itself, confirms submit, processes to Salesforce and then redirects to a confirmation page.

<form role="form" action="%%=RequestParameter('PAGEURL')=%%" method="GET">

   <input id="accountID" name="accountID" type="hidden" value="%%=v(@accountID)=%%">

   <input id="campaignID" name="campaignID" type="hidden" value="000000000000000000">


       <label for="firstName">*First Name</label>

       <input type="text" class="form-control" id="firstName" name="firstName" value="%%=v(@firstName)=%%" required>



       <label for="lastName">*Last Name</label>

       <input type="text" class="form-control" id="lastName" name="lastName" value="%%=v(@lastName)=%%" required>



       <label for="phone">*Phone</label>

       <input type="tel" class="form-control" id="phone" name="phone" value="%%=v(@phone)=%%" required>



       <label for="email">*Email</label>

       <input type="email" class="form-control" id="email" name="email" value="%%=v(@email)=%%" required>


   <button type="submit" name="Submit" id="Submit" value="Success">Submit</button>


3 Reasons to Keep the AMPScript in One Place

Why keep all the AMPScript in one place and not delegate some to confirmation page?

  1. AMPScript can be a tedious language to debug and having it all in one place allows for easier troubleshooting.
  2. It allows for easier organization of variables.
  3. You’ll ensure all rules have been met before processing out to a confirmation page.

To utilize this data, we will leverage the RequestParameter AMPScript function to pull our variables from the url upon form submit. We will also specifically look for a Submit parameter to initiate our processing scripts.



VAR @email, @accountID, @campaignID, @firstName, @lastName, @phone, @Submit

@Submit = RequestParameter("Submit")

SET @email = RequestParameter("email")

SET @accountID = RequestParameter("accountID")

SET @campaignID = RequestParameter("campaignID")

SET @firstName = RequestParameter("firstName")

SET @lastName = RequestParameter("lastName")

SET @phone = RequestParameter("phone")



For this function to work properly, RequestParameter(“variable”) must match what is outputted in the submission url. An easy way to ensure this would be to set form method=”GET” during development. From there, use SET to define your variables to be used within processing. This first step is fairly straightforward, but a few key factors need to be in place to start your process with a good foundation.

  1. Form settings: action=”%%=RequestParameter(‘PAGEURL’)=%%” method=“GET”
  2. Set value in Submit button to initiate form processing scripts upon form submission.
  3. Match URL parameters to RequestParameter variables exactly.

Now What: Next Steps

Want to see how to process your data into usable submissions and generate those leads in Salesforce? Watch for my next post coming soon: Marketing Cloud Lead Submission (Part 2): How to Process Your Data

And if you have any questions, feel free to reach out to our experts. We’re here to help.

Ask Our Experts

    Posted in: AMPScript, Marketing Cloud, Salesforce