0

I have successfully displayed subscribers data dynamically in custom preference center page using AMP script. Based on subscriberkey (Email) how can i update/upsert my subscriber profile in Data extension. How can i pass the requestparameters for update/upsert the subscribers data in Data extension dynamically in below code.

Here is my code

%%[

var @rows, @row, @rowCount, @i
set @rows = LookupRows("StudentProfile","Email", _subscriberKey)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
  for @i = 1 to @rowCount do
    var @Email, @FirstName, @LastName, @OptOut
    set @row = row(@rows, @i)
    set @FirstName = field(@row,"FirstName")
    set @LastName = field(@row,"LastName")
    set @Email = field(@row,"Email")
    set @OptOut = field(@row,"OptOut")
    ]%%
    
       %%[

  next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%

<!DOCTYPE html>
<html>
<body>
<h2>Student Form</h2>

<form>
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="@FirstName" value=%%=v(@FirstName)=%%><br>

  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="@LastName" value=%%=v(@LastName)=%%><br>

<label for="email">Email:</label><br>
  <input type="text" id="email" name="@Email" value=%%=v(@Email)=%%><br>

<label for="optout">OptOut:</label><br>
%%[IF @OptOut== True THEN]%%
      <input name="OptOut" value="Y" type="checkbox" checked/> 
      %%[Else]%%
      <input name="OptOut" value="Y" type="checkbox" /> 
      %%[ENDIF]%%


</form> 

</body>
</html>
5
  • salesforce.stackexchange.com/questions/102486/… Does this answer your question? Nov 18, 2020 at 9:20
  • @SwatiMishra No, I want to update StudentProfile data extension record fields like First Name, Last Name through landing page (preference center page). Nov 18, 2020 at 10:52
  • My be esit you question to clearly mention that you want to update data extension :) Nov 18, 2020 at 10:55
  • 1
    you will need a handler page. salesforce.stackexchange.com/questions/312937/… - when that page loads, it can do the upsert and you could redirect somewhere else (e.g. a thank you page) Nov 18, 2020 at 11:02
  • @JonasLamberty How to pass input parameters on preference center page using HTML code and AMP script and when values are passed through input parameters that value should be updated if it is otherwise inserted. like below First name: Test Last name: RRR Email: [email protected] Nov 23, 2020 at 14:56

0

You must log in to answer this question.