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>
  • salesforce.stackexchange.com/questions/102486/… Does this answer your question? – Swati Mishra Nov 18 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). – SFDCLearneR Nov 18 at 10:52
  • My be esit you question to clearly mention that you want to update data extension :) – Swati Mishra Nov 18 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) – Jonas Lamberty Nov 18 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: testuser@gmail.com – SFDCLearneR Nov 23 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.