AMPscript
Add
Attributes.Retrieve
Lists.Retrieve
Remove
Retrieve
Statistics
Unsubscribe
Update
Upsert
Validate Your Server-Side JavaScript using WSProxy
Updates a subscriber if one currently exists. If the subscriber does not exist, this function will add it.
Upsert(1)
| Ordinal | Type | Description | |
|---|---|---|---|
| 1 | string | Required |
This sample code updates the specified values for an existing subscriber or creates a new subscriber if necessary.
1var newSubscriber = {
2 "EmailAddress": "test.008@example.com",
3 "SubscriberKey": "20100730001",
4 "EmailTypePreference": "Text",
5 "Attributes":{"First Name": "test.008", "Last Name": "test.008" },
6 "Lists": {"Status": "Active", "ID": 12345, "Action": "Upsert"}
7};
8
9var subObj = Subscriber.Init("SubKey");
10var status = subObj.Upsert(newSubscriber);