I've built a CloudPages form with a handler. The form opens via a dynamic link from an email, which is web.formurl.com/form?PID=xUNIQUEKEYHEREx. It uses the unique key to retrieve their data and pre-populate the form.

On submitting the form, it directs to the handler which gets all the variables from the form via RequestParameter("form field here"), and runs an upsert query to our data extension.

One of the parameters it doesn't pass is the unique key it used to open the form, as this is not used in the form as there is no question for it. However, I still need to pass it into the handler to be used in the Upsert query. Whereas with the other parameters I'm getting them from the form fields, eg

set @firstname = RequestParameter("Firstname")

This one has no field to retrieve it from. It is however stored as a variable on the previous page as @pidmask. I have tried

set @pidmask = RequestParameter(@PIDMask)

But this doesn't seem to work - when the upsert query runs, it overwrites this field with a null value (which violates my data integrity). Any pointers?


I would suggest storing the PID in a hidden field within your form that's submitted to the form handler. Like this:

set @PIDMask = RequestParameter("PID")
<input type="hidden" name="PIDMask" value="%%=v(@PIDMask)=%%" />

Then your form handler can retrieve it from the URL.

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.