I'm looking to create an Email Send Definition via WSProxy. I am trying to mirror the SOAP Envelope for my proxy script.
I am getting an error when trying to create it; Error Code: 2...
<script runat='server'>
Platform.Load("core", "1.1.1");
//Get External/CustomerKey of ObjectID based on DE Name
function getDEobjectID(deName){
var prox = new Script.Util.WSProxy();
var cols = ["ObjectID"];
var filter = {
Property: "Name",
SimpleOperator: "equals",
Value: deName
};
var result = prox.retrieve("DataExtension", cols, filter);
var objectID = result.Results[0].ObjectID;
Write("ObjectID: " + objectID + "<br><br>");
return objectID;
};
var deName = "DEName";
var objectID = getDEobjectID(deName);
var prox = new Script.Util.WSProxy();
var esd = {
"Name": "SOAP_ESD_test1",
"SendDefinitionList": [{
"CustomObjectID": objectID,
"DataSourceTypeID": "CustomObject"
}],
"Email": {
"ID": 6499
},
"SendClassification": {
"CustomerKey": "Default Commercial"
}
};
try {
var res = prox.createItem("EmailSendDefinition", esd);
Write('Response: ' + Stringify(res) + '<br><br>');
} catch (e) {
Write(Stringify(e));
}
</script>