I've created a Trigger Email (Email Studio> Interactions> Triggered Emails) whose external key is 2241.
This has 64 in completed count and 0 in queued and errored. I'm trying to get this 'completed' count (along with sub key, date/time email sent etc.,) using below SSJS.
But this does not seem to return completed count. Why is that? Any alternates / thoughts please?
Result from SSJS:
{
"Status": "OK",
"RequestID": "976ad729-ac1c-4fc2-bb93-49b5f778f2c8",
"Results": [{
"ObjectID": null,
"CustomerKey": "2241",
"Sent": 0,
"NotSentDueToOptOut": 0,
"NotSentDueToUndeliverable": 0,
"NotSentDueToError": 0,
"Bounces": 0,
"OptOuts": 0,
"InProcess": 0,
"Queued": 0,
"TriggeredSendDefinition": null,
"Opens": 0,
"Clicks": 0,
"UniqueOpens": 0,
"UniqueClicks": 0,
"SurveyResponses": 0,
"FTAFRequests": 0,
"FTAFEmailsSent": 0,
"FTAFOptIns": 0,
"Conversions": 0,
"UniqueConversions": 0,
"Client": null,
"PartnerKey": null,
"PartnerProperties": null,
"CreatedDate": "0001-01-01T00:00:00.000",
"ModifiedDate": null,
"ID": 0,
"Owner": null,
"CorrelationID": null,
"ObjectState": null,
"IsPlatformObject": false
}],
"HasMoreRows": false
}
SSJS
<script runat="server">
Platform.Load("core","1.1.5");
try {
var prox = new Script.Util.WSProxy();
/* Set ClientID */
if (mid) {
prox.setClientId({ "ID": mid }); //Impersonates the BU
}
var customerKey = 2241;
var cols = ["CustomerKey","Queued"];
var filter = {
Property: "CustomerKey",
SimpleOperator: "Equals",
Value: customerKey
};
var res = prox.retrieve("TriggeredSendSummary", cols, filter);
var results = res
Write(Stringify(res))
}
catch (e) {
Write("<br>" + Stringify(e))
}
</script>