Last active
October 5, 2020 13:37
-
-
Save zuzannamj/abd5371f885ee258e3310c4cd9af2675 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
set @subscriberKey = AttributeValue(_subscriberKey) | |
set @subscriberRows = RetrieveSalesforceObjects( | |
"Contact", | |
"FirstName,LastName,Email,Preferences__c", | |
"Id", "=", @subscriberKey ) | |
if RowCount(@subscriberRows) == 1 then /* there should only be one row */ | |
var @subscriberRow, @firstName, @lastName, @email | |
set @subscriberRow = Row(@subscriberRows, 1) | |
set @firstName = Field(@subscriberRow, "FirstName") | |
set @lastName = Field(@subscriberRow, "LastName") | |
set @email = Field(@subscriberRow, "Email") | |
set @Preferences__c = Field(@subscriberRow, "Preferences__c") | |
IF NOT EMPTY(@Preferences__c) THEN | |
SET @rs = BuildRowsetFromString(@Preferences__c,';') | |
IF rowcount(@rs) > 0 THEN | |
FOR @i=1 TO rowcount(@rs) DO | |
SET @val = Field(Row(@rs,@i),1) | |
IF @val == "Surveys" THEN | |
SET @Surveys = "checked" | |
ELSEIF @val == "Events" THEN | |
SET @Events = "checked" | |
ELSEIF @val == "Newsletters" THEN | |
SET @Newsletters = "checked" | |
ELSEIF @val == "Promotions" THEN | |
SET @Promotions = "checked" | |
ELSEIF @val == "Special Offers" THEN | |
SET @Offers = "checked" | |
ENDIF | |
NEXT @i | |
ELSE | |
SET @Newsletters = "" | |
SET @Events = "" | |
SET @Offers = "" | |
SET @Survays = "" | |
SET @Promotions = "" | |
ENDIF | |
ENDIF | |
endif | |
]%% | |
<h2>Please fill in the form:</h2> | |
<form action="%%=RequestParameter('PAGEURL')=%%" method="post"> | |
<label>First name: </label><input type="text" name="firstname" required="" value="%%=v(@firstName)=%%"><br> | |
<label>Last name: </label><input type="text" name="lastname" required="" value="%%=v(@lastName)=%%"><br> | |
<label>Email: </label><input type="text" name="email" required="" value="%%=v(@email)=%%"><br><br> | |
<h2>Update your subscriptions:</h2> | |
<input name="newsletters" type="checkbox" %%=v(@Newsletters)=%%><label>Newsletters</label><br> | |
<input name="events" type="checkbox" %%=v(@Events)=%%><label>Events</label><br> | |
<input name="offers" type="checkbox" %%=v(@Offers)=%%><label>Special Offers</label><br> | |
<input name="surveys" type="checkbox" %%=v(@Surveys)=%%><label>Surveys</label><br> | |
<input name="promotions" type="checkbox" %%=v(@Promotions)=%%><label>Promotions</label><br> | |
<input name="submitted" type="hidden" value="true"><br> | |
<input type="submit" value="Submit"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment