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">


  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);


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?

2 Answers 2


First, let's see what you would get in the response using Write(Stringify(res)):

   "Status":"Error: AutomationActivityInstance is not a valid ObjectType.",

Looks like the API does not recognize this object.

Let's see if we can do retrieve operations on it by checking the documentation: Supported Operations for Objects and Methods

Given that it's not listed, we can only assume we can't access it, but being a bit mistrustful about the documentation, we just do a describe operation to make sure:

var prox = new Script.Util.WSProxy();
var res = prox.describe("AutomationActivityInstance");

the results are disappointing:


So no, it does not seem we can work with this object at all - you would get the same response if you looked for Unobtainium.

Can we find this data with the REST API?

there's a undocumented automation endpoint (credits go to Gortonington) where you can do a discovery GET request: /automation/v1/rest

In response you will get a collection of all automation routes, but there seems to be none connected to the AutomationActivityInstance, but maybe check for yourself, maybe you will find something useful there.

  • Thank you very much for the clear explanation, very helpful.
    – user12971
    Jul 15, 2022 at 7:48
  • 1
    @user12971 No, problem, glad I could help. If you would accept non-precise start and end dates, you could place 2 script activities on consecutive steps in your automation. The first one could log the start date of the entire automation step and the second script could update the record from the first one with the start date of the next step - this would kind of give you the end date of an entire automation step. Jul 15, 2022 at 7:56

This is undocumented too but worth to check. "ActivityInstance" looks like the replacement of AutomationActivityInstance. Check for extra info https://charliefay.medium.com/sfmc-automation-studio-api-objects-620ec868239b

  • Made my day! The object name works perfect to me!
    – Duc Le
    Feb 9, 2023 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .