verified
Delete a SubscriberLearn how to delete a Subscriber in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the WSProxy method.
WSProxy
var api = new Script.Util.WSProxy();
var config = {
SubscriberKey: "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
EmailAddress: "example@mail.com",
Status: "Deleted"
};
var result = api.deleteItem("Subscriber", config);
<script runat="server">
Platform.Load("core", "1");
var api = new Script.Util.WSProxy();
try {
var config = {
SubscriberKey: "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
EmailAddress: "example@mail.com",
Status: "Deleted"
};
var result = api.deleteItem("Subscriber", config);
Write(Stringify(result));
} catch (error) {
Write(Stringify(error));
}
</script>
{
"Status": "OK",
"RequestID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"Results": [
{
"Object": null,
"StatusCode": "OK",
"StatusMessage": "Subscriber deleted",
"OrdinalID": 0,
"ErrorCode": 0,
"RequestID": null,
"ConversationID": null,
"OverallStatusCode": null,
"RequestType": "Synchronous",
"ResultType": null,
"ResultDetailXML": null
}
]
}
Reference
Ressources and references related to the current methods.
Official documentation
SOAP object