0

I need help with updating existing data in a data extension. When a user clicks on an email link to change their status, I need it to be changed in the data extension. For example, if user A has status X , when he clicks the button , they need to be updated to status Y. I need to do it in AMPscript. Can you help me with this?

This is the code I've written so far:

%%[
  var @reservationid, @hotel_name, @city, @country, @fromdate, @todate, @value, @customerid,@reservationstatus
  set @reservationid = RequestParameter("reservationid")
  set @reservationstatus = RequestParameter("reservationstatus")
  set @customerid = RequestParameter("customerid")
  set @hotel_name = RequestParameter("hotel_name")
  set @city = RequestParameter("city")
  set @country = RequestParameter("country")
  set @value = RequestParameter("value")
  set @fromdate = RequestParameter("fromdate")
  set @todate = RequestParameter("todate")
  set @salutation = RequestParameter("salutation")
  set @firstname = RequestParameter("firstname")
  set @lastname = RequestParameter("lastname")
  
  

  Var @Submit
  Set @Submit = RequestParameter('submitted')
  If @Submit == 'submitted' Then
    UpsertDE('Final_Task_Table',1,'reservationid',@reservationid,'reservationstatus', 'cancelled')
  Endif
  
  
  ]%%
3
  • 2
    Have you tried to write the script yourself? People here generally appreciate, if the asking person made an effort to solve the problem on her/his own. In addition to that presenting your script would make it clear in much more detail what you want. Commented Mar 28 at 14:22
  • @FelixvanHove sorry for that, I just updated.
    – xhb
    Commented Mar 29 at 2:02
  • Good that u shared the code, can you share what is the error/issue you are facing now... hope u are having a hidden input field in ur code something like this <input type='hidden' name='submitted' value='submitted' /> Commented Mar 29 at 5:36

1 Answer 1

0

UpsertDE function only works in email send context. Use UpsertData to add or insert rows into a Data Extension in a Cloudpage.

Try to change the UpsertDE line to this:

UpsertData('Final_Task_Table',1,'reservationid',@reservationid,'reservationstatus', 'cancelled')

You must log in to answer this question.

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