verified
Update a ListLearn how to update a List in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the WSProxy method.
WSProxy
var api = new Script.Util.WSProxy();
var result = api.updateItem("List", {
ID: 12345,
Description: "This is my updated list"
});
<script runat="server">
Platform.Load("core", "1");
var api = new Script.Util.WSProxy();
try {
var request = api.retrieve("List", ["ID"], {
Property: "ListName",
SimpleOperator: "equals",
Value: "MyNewList"
});
var id = request.Results[0].ID;
var config = {
ID: id,
Description: "This is my updated list"
}
var result = api.updateItem("List", config);
Write(Stringify(result));
} catch (error) {
Write(Stringify(error));
}
</script>
{
"Status": "OK",
"RequestID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"Results": [
{
"Object": {
"ID": 12345,
"CreatedDate": "0001-01-01T00:00:00.000",
"ListName": null,
"Description": "This is my updated list",
"Type": "Public",
"CustomerKey": null,
"Category": 0,
"Subscribers": null,
"ListClassification": "ExactTargetList",
"AutomatedEmail": null,
"OptInProfile": null,
"SendClassification": null,
"Client": null,
"PartnerKey": null,
"PartnerProperties": null,
"ModifiedDate": null,
"ObjectID": null,
"Owner": null,
"CorrelationID": null,
"ObjectState": null,
"IsPlatformObject": false
},
"UpdateResults": null,
"ParentPropertyName": null,
"StatusCode": "OK",
"StatusMessage": "Updated List.",
"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