-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter61.amp
More file actions
41 lines (29 loc) · 1.7 KB
/
chapter61.amp
File metadata and controls
41 lines (29 loc) · 1.7 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
%%[
/*
This ampscript code block retrieves all subscriberkey associated with
a give email addess, this code is useful to be executed to find
all duplicate subscriberkey for a given email address
*/
/* Replace with the email address you are searching for */
SET @email="john.begood@example.com"
/* Create the RetrieveRequest object to retrieve the Subscriber by EmailAddress */
SET @subscriberRetrieveRequest = CreateObject("RetrieveRequest")
SetObjectProperty(@subscriberRetrieveRequest, "ObjectType", "Subscriber")
AddObjectArrayItem(@subscriberRetrieveRequest, "Properties", "EmailAddress")
AddObjectArrayItem(@subscriberRetrieveRequest, "Properties", "SubscriberKey")
/* Create and configure the filter for the RetrieveRequest */
SET @emailFilter = CreateObject("SimpleFilterPart")
SetObjectProperty(@emailFilter, "Property", "EmailAddress")
SetObjectProperty(@emailFilter, "SimpleOperator", "equals")
AddObjectArrayItem(@emailFilter, "Value", @email)
SetObjectProperty(@subscriberRetrieveRequest, "Filter", @emailFilter)
/* Invoke the RetrieveRequest to get the Subscriber object */
SET @subscriberResponse = InvokeRetrieve(@subscriberRetrieveRequest, @retrieveStatus, @retrieveRequestID)
/* Iterate over the retrieved subscriber rows */
FOR @rowIndex = 1 TO RowCount(@subscriberResponse) DO
SET @subscriberRow = Row(@subscriberResponse, @rowIndex)
SET @retrievedSubscriberKey = Field(@subscriberRow, "SubscriberKey")
/* Output the SubscriberKey */
OutputLine(Concat("Retrieved SubscriberKey: ", @retrievedSubscriberKey))
NEXT @rowIndex
]%%