Here's the code that I have (below). I'm trying to find out how I can retrieve a list of automations that do not have an "Error" notification recipient set. I did find the API field name called "Notifications" which is of data type AutomationNotification[]
but this is marked as NOT "retrievable". Thus, it's returning a NULL value for what I expect to see the Notification recipients. Is there any way around this? We would love to have a list of ALL automations that do NOT have the error notification recipient set.
<script runat="server">
Platform.Load("Core","1.1.1");
var prox = new Script.Util.WSProxy();
var cols = ["Name","Status","Notifications"];
var filter = {
Property: "Status",
SimpleOperator: "IN",
Value: [-1,0,1,2,3,4,5,6,7,8]
};
var res = prox.retrieve("Automation", cols, filter);
if (res.Results.length > 0) {
var statusObj = {
"-1":"Error",
"0":"BuildingError",
"1":"Building",
"2":"Ready",
"3":"Running",
"4":"Paused",
"5":"Stopped",
"6":"Scheduled",
"7":"Awaiting Trigger",
"8":"InactiveTrigger"
}
Write('<table align="center" border="1" cellpadding="5" ><tr><th colspan="2">Automation Dashboard</th></tr>')
for (var i = 0; i < res.Results.length; i++) {
var autoName = res.Results[i].Name;
var autoStatusNum = res.Results[i].Status;
var autoStatus = statusObj[autoStatusNum];
var autoNotifications = res.Results[i].Notifications;
Write('<tr><td>' + autoName + '</td><td>' + Platform.Function.Stringify(autoNotifications) + '</td></tr>')
}
Write('</table>')
}
</script>
Stringify(res.Results)
in your debugging table?