I am trying to work on SSJS script to fetch the details about the automation activities. I found an object called AutomationActivityInstance - https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationactivityinstance.html .This object has all the information I need. I want to fetch the start time & end time of the activity in an automation.
Here is my SSJS
<script runat="server">
Platform.Load("Core","1");
var prox = new Script.Util.WSProxy();
var cols = ["Name","StartTime","CompletedTime"];
var filter = {
Property: "IsActive",
SimpleOperator: "equals",
Value: "true"
};
var res = prox.retrieve("AutomationActivityInstance", cols, filter);
for (var i = 0; i < res.Results.length; i++) {
//fetch the properties
var Name = res.Results[i].Name;
Write ("RES:"+Name);
}
</script>
This code does not return anything. It shows up as blank. Please can anyone point out what I am doing wrong in the code? I want to fetch this data using the object -AutomationActivityInstance.
Or is there any API endpoint that derives the automation activity start & end time?