Last active
November 6, 2020 13:00
-
-
Save MamaiRachid/88f6ab73be9131008f594c1d95c2d68f to your computer and use it in GitHub Desktop.
Code Snippet AMPScript code to unsubscribe a contact from Sales Cloud through a creation of a Task (Data Privacy app)
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
%%[ var @rows, @row, @rowCount, @subKey, @counter | |
set @rows = LookupRows("BRANDA_COMPLAINTS","OYBAccountID","50000XXXX","Secret", 1) | |
set @rowCount = rowcount(@rows) | |
if @rowCount > 0 then | |
for @counter = 1 to @rowCount do | |
set @row = row(@rows, @counter) | |
set @subKey = field(@row,"SubscriberKey") | |
set @created_taskId= CreateSalesforceObject('Task',3,'WhoId', @subKey, 'Subject', 'Datapm:Unsubscribe', 'Description', '{"channel":"email"}') | |
next | |
endif | |
InsertDE("COMPLAINTS_LOG","SubscriberKey", @subKey,"Event_Date", FormatDate(Now(),"iso")) | |
]%% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment