Skip to content

Instantly share code, notes, and snippets.

@zachboyd
Last active October 11, 2016 17:53
Show Gist options
  • Save zachboyd/eb8c6aee3e0a289fe5551a56d280e6d6 to your computer and use it in GitHub Desktop.
Save zachboyd/eb8c6aee3e0a289fe5551a56d280e6d6 to your computer and use it in GitHub Desktop.
Salesforce Marketing Cloud - Update Contact with AMP example
<div>
%%[
var @Id, @contactRecord, @limitRow, @firstName, @lastName
set @Id = RequestParameter('id')
set @firstName = RequestParameter('firstName')
if RequestParameter("submitted") == "submitted" then
var @result
set @result = UpdateSingleSalesforceObject("Contact", @Id, "FirstName", @firstName)
endif
set @contactRecord = RetrieveSalesforceObjects('Contact','FirstName, LastName','Id','=', @Id)
set @limitRow = Row(@contactRecord, 1)
set @firstName = Field(@limitRow,'FirstName')
set @lastName = Field(@limitRow,'LastName')
]%%
<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
<input id="submitted" type="hidden" name="submitted" value="submitted" />
<input type="text" name="firstName" value="%%=v(@firstName)=%%" />
<input type="text" name="lastName" value="%%=v(@lastName)=%%" />
<input type="submit" value="Submit">
</form>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment