0

I created a survey on a marketing cloud landing page and sent it to another landing page using this html:

<form method="post" name="CustomerSatisfaction" action="%%=RedirectTo(CloudPagesURL(1682,'fullName',RequestParameter('fullName'),
'company',RequestParameter('company'),'email',RequestParameter('email'),'sex',RequestParameter('sex'),'rating',RequestParameter('rating'),'explain',RequestParameter('explain')))=%%" >

I am attempting to update an existing data extension with the results from this survey. The only column that is not in this code is the 'key', which is also my primary key for the DE. Below is my code:

%%[ /* Retrieve request */
VAR @fullName, @company, @email, @rating, @explain, @createDERecord
set @fullName = QueryParameter('fullName')
set @company = QueryParameter('company')
set @email = QueryParameter('email')
set @rating = QueryParameter('rating')
set @explain = QueryParameter('explain')
set @createDERecord = InsertData(
    'MonkeylessSurvey_DE_Intern',
    'fullName',@fullName,
    'company',@company,
    'email',@email,
    'rating',@rating,
    'explain',@explain)
]%%

It's allowing me to publish, but when I try to open the website I get an "Internal Server Error 500".

How do I solve this?

EDIT:

Data Extension Structure

0

I will recommend you a better approach than what you are trying to achieve. You can have the same page to both contain the form as well as the submit logic.

Also, you do need to have your Primary Key in payload, as this is used to identify the row to be updated, or create a new row if the key value is not found. I have not included that key in the below example, as I am not sure of its name.

<html lang="en">
  <head>
  </head>

  <body>

%%[
var @email, @fullName, @company, @rating, @explain, @createDERecord

set @fullName = RequestParameter('fullName')
set @company = RequestParameter('company')
set @rating = RequestParameter('rating')
set @explain = RequestParameter('explain')
set @email = RequestParameter('email')

if RequestParameter("submitted") == "submitted" then

   set @createDeRecord = InsertDE(
    'MonkeylessSurvey_DE_Intern',
    'fullName',@fullName,
    'company',@company'
    'rating',@rating,
    'explain',@explain',
    'Email',@email)
endif

]%%

<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
<label>Full Name</label>
<input type="text" name="fulname">

<label>Company</label>
<input type="text" name="company">

<label>Email</label>
<input type="text" name="email">

<label>Rating</label>
<input type="text" name="rating">

<label>Explain</label>
<input type="text" name="explain">

<input id="submitted" type="hidden" name="submitted" value="submitted" />

<input type="submit" value="Submit">
</form>

%%=IIF(RequestParameter("submitted") == "submitted", '<p>Your form has been submitted.</p>','')=%%

</body>
</html>
  • I am getting problems with this code. I replaced my code with your code for the form, the ampscript, and the iif and it didn't work. I also straight up made a new landing page copying and pasting your code and it also gave me errors. I checked my data extension and all the names match. Would you know what the problem is? – Intern Jun 19 '19 at 15:04
  • Initial guess: Are you editing your code in a code block? Or in the WYSIWYG editor? You must use code block, as your ampscript otherwise gets fubar. And what does "didn't work" mean? – Lukas Lunow Jun 19 '19 at 15:08
  • I'm not sure what you mean by code block; I am using an html block from the content builder. What I mean is that the survey page opens, but when I fill out the survey and click the submit button I get a "500 - Internal Server Error" page – Intern Jun 19 '19 at 15:28
  • Can you share the structure of MonkeylessSurvey_DE_Intern in your question? E.g. by taking a screenshot of the field names and types . – Lukas Lunow Jun 19 '19 at 16:19
  • I added the screenshot to the original post – Intern Jun 19 '19 at 16:54

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.