0

I have a CloudPage form. Is it possible to update a record already exist in the target DE? Let's give you an example:

The target DE has a Primary Key email. Every other field is nullable. Person A goes to the form and fill out the form with email address test@test.com. After a while he goes again to the form and fills out the form again with the same email address test@test.com. But with other data then the first one. Is it possible he overrides the DE and puts the last filled in data in the target DE?

  • what type of form are you using? Are you using web collect or smart capture? Are you posting to a processing page, or to DEmanager? – Gortonington Dec 19 '18 at 13:56
  • I am using a basic smart capture form linked on my DE. – Martijn e Dec 20 '18 at 14:05
1

You'll need to use UpsertData AMPscript function for this.

There are plenty of examples in Stack with solution provided for your use case. Do note that this function works only in a landing, microsite or Cloud Page, or in SMS message and NOT in Emails.

  • Thanks Rain. I did look at the other samples but it looks there is something wrong with my UpsertData function. If i want't to publish my page it remains polling and the cloudpage gives a 500 internal server error. It is only with the upsertData because if i delete that piece of code it saves and publish right away and the page is showing. I just want to update data based on the primary key wich is the email: %%[UpsertDE("Martijn_content_nb_form_test",1,"email",@email]%% Is there something that i miss? – Martijn e Dec 20 '18 at 10:41
  • Yes, you are using UpsertDE function while it should be UpsertData function. For that you need to fill in all the 6 required parameters of the function, please check the link for all of those. – Rain Dec 20 '18 at 12:51
  • Ahh ok. I adjust my amp and now i don't get any errors so that is good. The only thing is that i can't use the same email address. The first time he post my data in the DE and the second time he don't post it with the same email. THis is my code: %%[UpdateData("Martijn_content_nb_form_test",1,"email",martijn.emmerzaal@postnl.nl,'updateDate',NOW())]%% The updateDate before the NOW is a DE field. – Martijn e Dec 20 '18 at 13:51
  • You are using UpdateData, not UpsertData? Anyway you are using double-quotes where not needed, try using the correct format. In addition you are inserting your hard-coded Email value, not dynamically set one. – Rain Dec 20 '18 at 13:57
  • Hi all, I tried and tried but with no result. If i put this code in i can publish the page and insert 1 record. When i try to update the record with the same emailaddress it stays on the page and don't update: '%%[ UdateData("Martijn_content_nb_form_test",1,"email", emailAddress, "email", emailAddress) ]%%' If i do something like this i even can't publisch the page. It remains polling: '%%[ var Email set Email = [emailAddress] UdateData("Martijn_content_nb_form_test",1,"email", emailAddress, "email", emailAddress) ]%%' Any new ideas? I can't figure it out. Thanks. – Martijn e Feb 1 at 14:07

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.