I'd like to set up a weekly automated report for all the Automations that ran in the last 7 days with a success or fail update. The goal would be to keep the email team more informed on what automations ran and what errored out.

I know we can sign up for notifications for success or failure for each automation individually; however, our team works with multiple BUs and those notifications can get overwhelming quickly.

So basically we're looking for a list of automations scheduled to run and the success/failure rate for each day.


We have developed a similar solution for our client.

The idea is to use the automation instance object in conjunction with ssjs. There is a field known as 'Status' which you can use to fetch the instance status. However, the catch is that this object does not accept and clause. That means you can't say all the automation instances that ran in last 7 days and have status = Error. Hence, you can go about this solution.

  1. Fetch all the automation instances that ran in last 7 days. If you have less than 5 automations to monitor in each BU, you can utilize the IN Parameter and pass the automation customer key as an array. (The reason for 5 automations is that the limit for Customerkey value in the filter is 400 characters)

  2. For each automation instance, you can store the values in a DE.(Automation ID, Automation Name, Status)

  3. Extract this and store on FTP, use Attach File function in the email and send the email. All this will be part of an automation that you can schedule.

             var childreqID = null;
             var childprops = null;
             var childmoreObjs = true;
             prox.setClientId({"ID": mid});// You can use proxy,mid and run this in Parent BU for all BUs
             var AutomationInstance = "AutomationInstance";
             var childcols = ["CustomerKey","Status","StartTime","StatusLastUpdate","Name"];  
                         var childfilter = {
                         Value:  CustomerKey //Array of Customer Keys
         while (childmoreObjs)
             childmoreObjs = false;
             var childobjs = childreqID == null ? prox.retrieve(AutomationInstance, childcols, childfilter) : prox.getNextBatch(childobjs, childreqID);
         if (childobjs != null) 
             childmoreObjs = childobjs.HasMoreRows;
         childreqID = childobjs.RequestID;
         var resultsStore = [];          
             for (var u = 0; u < childobjs.Results.length;u++)
                     var automationInsitanceObj = childobjs.Results[u]; 
                     var StartTime = automationInsitanceObj.StartTime;       
                     var customerkey = automationInsitanceObj.CustomerKey;
                     var instancestatus = automationInsitanceObj.Status;  
                     var AutomationName = automationInsitanceObj.Name
                     var today = new Date();
                     var prevDate = new Date();
                     var yesterday = new Date((new Date()).valueOf() - 1000*60*60*24); //Checking for automation in last 24 hours. You can modify for last 7 days
         if(StartTime >= yesterday && instancestatus == -1) //Checking if this intnace is in  error
         var rows  = Platform.Function.UpsertData('Automation_Monitoring',['MID','CustomerKey'],[mid,customerkey],['Status','ErrorDate','AutomationName','BusinessUnit','FolderName'],["Error",StartTime,AutomationName,marketName,foldername]);
         //Updating in  a DE    
         }//end for       
             }//end if
                 }// end while
         }// end try
         catch (e)
             Platform.Response.Write("child object error for" + Stringify(e)); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.