-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter54.amp
More file actions
44 lines (35 loc) · 1.88 KB
/
chapter54.amp
File metadata and controls
44 lines (35 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%%[
/* Assign values for SubscriberKey and EmailAddress */
SET @subscriberKey = AttributeValue("_subscriberkey")
SET @emailAddress = AttributeValue("emailaddr")
/* Create a new Subscriber object */
SET @subscriberObject = CreateObject("Subscriber")
SetObjectProperty(@subscriberObject, "EmailAddress", @emailAddress)
SetObjectProperty(@subscriberObject, "SubscriberKey", @subscriberKey)
/* Set the status of the subscriber to Unsubscribed */
SetObjectProperty(@subscriberObject, "Status", "Active")
/* Create a new ClientID object */
SET @clientIdObject = CreateObject("ClientID")
SetObjectProperty(@clientIdObject, "ID", AuthenticatedMemberID())
SetObjectProperty(@clientIdObject, "IDSpecified", "true")
/* Associate the ClientID object with the Subscriber */
SetObjectProperty(@subscriberObject, "Client", @clientIdObject)
/* Define Update Options */
SET @updateOptions = CreateObject("UpdateOptions")
SET @saveOption = CreateObject("SaveOption")
SetObjectProperty(@saveOption, "SaveAction", "UpdateAdd")
SetObjectProperty(@saveOption, "PropertyName", "*")
AddObjectArrayItem(@updateOptions, "SaveOptions", @saveOption)
/* Update the Subscriber object */
SET @updateStatus = InvokeUpdate(@subscriberObject, @updateStatusMessage, @updateErrorCode, @updateOptions)
/* Log the subscriber details and status of the update operation */
SET @logDataExtensionName = "InvokeUpdate" /* Replace with your logging data extension name */
SET @logStatus = InsertData(
@logDataExtensionName,
"updateStatus", @updateStatus,
"updateStatusMessage", @updateStatusMessage,
"updateErrorCode", @updateErrorCode,
"subscriberKey", @subscriberKey,
"emailAddress", @emailAddress
)
]%%