1

On the landing page I have a form that is submitting and gathering all the RequestParameter values. When it gets to the UpsertData function it doesn't fire even the few values I have in the function to the data extension. Not sure why its not putting the data into the data extension. Thanks for any help. Let me know if you need any further code.


<script runat="server">
  Platform.Load("Core", "1");
  HTTPHeader.SetValue("Access-Control-Allow-Methods","POST");
  HTTPHeader.SetValue("Access-Control-Allow-Origin","*");
  try {
</script>
<br><br>
%%[
  VAR @data_extension, @email, @firstName, @lastName, @phone, @company, @jobTitle, @city, @state, @zipCode, @fpAccountNumber, @fpNews, @fpTextAlerts, @createdDate, @srcCampaign, @srcLandingPage, @botCheck, @submit

  SET @data_extension = "Test_LP_GeneralForm_Display"

  SET @email = RequestParameter("Email Address")<br>
  SET @firstName = RequestParameter("First Name")<br>
  SET @lastName = RequestParameter("Last Name")<br>
  SET @phone = RequestParameter("Primary Phone")<br>
  SET @company = RequestParameter("Company")<br>
  SET @jobTitle = RequestParameter("Job Title")<br>
  SET @city = RequestParameter("City")<br>
  SET @state = RequestParameter("State")<br>
  SET @zipCode = RequestParameter("Zip Code")<br>
  SET @accountNumber = RequestParameter("Account Number")<br>
  SET @news = RequestParameter("Subscribe to News")<br>
  SET @textAlerts = RequestParameter("Subscribe to Text Alerts")<br>
  SET @createdDate = RequestParameter("Created Date")<br>
  SET @srcCampaign = RequestParameter("Source Campaign")<br>
  SET @srcLandingPage = RequestParameter("Source Landing Page")<br>
  SET @botCheck = RequestParameter("Bot Check")<br>
  SET @submit = RequestParameter("Submit")<br>
  
  
  UpsertData("@data_extension", 1, "Email Address", @email, "First Name", @firstName, "Last Name", @lastName) 

]%%
<br><br>
<script runat="server">
  } catch (e) {
    Variable.SetValue("errorMessage", Stringify(e.message) + Stringify(e.description));
  }
</script>
2
  • are you sure you have value in those var? I would suggest printing them to confirm
    – EazyE
    Feb 11, 2022 at 0:03
  • Yeah, I have printed all the variables and they come in on the landing page.
    – Ryan
    Feb 11, 2022 at 0:21

1 Answer 1

2

The issue is the quotes around your DE name.

UpsertData("@data_extension", 1, "Email Address", @email, "First Name", @firstName, "Last Name", @lastName)

Should be

UpsertData(@data_extension, 1, "Email Address", @email, "First Name", @firstName, "Last Name", @lastName)

Otherwise it is looking for a data extension named @data_extension not the value of the AMPscript variable named @data_extension

Also wanna remove those <br> tags in your script.

You must log in to answer this question.

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