Last active
October 5, 2020 13:38
-
-
Save zuzannamj/ccf76a671d6087ef82a19272ce25a996 to your computer and use it in GitHub Desktop.
This file contains 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 = true | |
ELSEIF @val == "Events" THEN | |
SET @Events = true | |
ELSEIF @val == "Newsletters" THEN | |
SET @Newsletters = true | |
ELSEIF @val == "Promotions" THEN | |
SET @Promotions = true | |
ELSEIF @val == "Special Offers" THEN | |
SET @Offers = true | |
ENDIF | |
NEXT @i | |
ELSE | |
SET @Newsletters = "" | |
SET @Events = "" | |
SET @Offers = "" | |
SET @Survays = "" | |
SET @Promotions = "" | |
ENDIF | |
ENDIF | |
endif | |
]%% | |
@Surveys: %%=v(@Surveys)=%%<br> | |
@Events: %%=v(@Events)=%%<br> | |
@Newsletters: %%=v(@Newsletters)=%%<br> | |
@Promotionss: %%=v(@Promotions)=%%<br> | |
@Offers: %%=v(@Offers)=%%<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment