What are data views?
Marketing Cloud Data_views, are nothing but the pre-built back-end Data Extensions that provide information about automations. These data_views let you to create different views of the data stored in a DataTable. These Marketing Cloud Data_views are generally used to fetch information about your subscribers and use that information for future analysis. Although you cannot change Marketing Cloud Data_views, you can still leverage their data in SQL Queries for reports.
Automation data view
Automation data_views are pre-built views in the Marketing Cloud. These views keep a check on the status of the automation.
There are two data views for Salesforce Marketing Cloud Automations.
- Automation Instance(_AutomationInstance)
- Automation Activity Instance(_AutomationActivityInstance)
Automation Instance(_AutomationInstance)
This data view helps
- Automations that ran recently like in the last 30 days
- When automation ran
- The duration of an automation
- Whether automation succeeded, skipped, or failed
- The reason automation failed
- The file that was being processed when triggered automation failed
- The email addresses of the automation success/failure notifications
Data_views Columns:
NAME | DESCRIPTION | DATA EXTENSION DATA TYPE |
MemberID | The unique ID of the business unit. | Number |
AutomationName | The automation name. | Text |
AutomationDescription | The automation description. | Text |
AutomationCustomerKey | The unique ID of the automation. | Text |
AutomationType | The automation’s starting source. Possible values are Schedule, File Drop, or Trigger. | Text |
AutomationNotificationRecipient_Complete | The email address where notifications about completed automations are sent. | Text |
AutomationNotificationRecipient_Error | The email address where notifications about automation errors are sent. | Text |
AutomationNotificationRecipient_Skip | The email address where notifications about skipped automations are sent. | Text |
AutomationStepCount | The number of steps in the automation. | Number |
AutomationInstanceID | The unique ID of the automation run. | Text |
AutomationInstanceIsRunOnce | Whether the automation was set to run once. 1 = true, 0 = false. | Boolean |
FilenameFromTrigger | For file drop and trigger automations, the file that started the automation. | Text |
AutomationInstanceScheduledTime_UTC | For scheduled automations, the time that the run was scheduled to begin. | Date |
AutomationInstanceStartTime_UTC | The time that the automation run started. This value is null if the automation was skipped. | Date |
AutomationInstanceEndTime_UTC | The time that the automation run ended. This value is null if the automation was skipped or is still running. | Date |
AutomationInstanceStatus | The status of the automation run when the data_views is queried. Possible values are QueuedFile, Initialized, Executing, Stopped, Complete, or Error. | Text |
AutomationInstanceActivityErrorDetails | The message from the error log, if applicable. If a system or unclassified error occurs, the value is System Error. If multiple errors occur, only the first message is displayed. To get details on multiple errors, use the _AutomationActivityInstance view. | Text |
Automation Activity Instance(_AutomationActivityInstance)
This data view helps us in collecting more information about the activity, which enables us to prevent time-out errors in our activity.
This data view helps
- Activities that ran in an automation
- When an activity ran
- The duration of an activity
- Whether an activity succeeded or failed
- The reason an activity failed
The limitations of both these types of data views can be that we can only obtain activity data after 24 hours and within 31 days, respectively.
Data views Columns
NAME | DESCRIPTION | DATA EXTENSION DATA TYPE |
MemberID | The unique ID of the business unit. | Number |
AutomationName | The automation name. | Text |
AutomationCustomerKey | The unique ID of the automation. | Text |
AutomationInstanceID | The unique ID of the automation run. | Text |
ActivityType | The activity type. Possible values are listed in the Activity Type IDs table. | Number |
ActivityName | The activity name. | Text |
ActivityDescription | The activity description. | Text |
ActivityCustomerKey | The unique ID of the activity. | Text |
ActivityInstanceStep | Where the activity occurs in the automation. For example, 3.2 is step 3, activity 2. | Text |
ActivityInstanceID | The unique ID of the activity run. | Text |
ActivityInstanceStartTime_UTC | The time that the activity run started. This value is null if the automation was skipped. | Date |
ActivityInstanceEndTime_UTC | The time that the activity run ended. This value is null if the automation was skipped, is still running, or wasn’t selected as part of an Advanced Run Once. | Date |
ActivityInstanceStatus | The status of the activity run when the data_views is queried. Possible values are Initialized, Executing, Complete, Error, or Not Selected. | Text |
ActivityInstanceStatusDetails | The message from the error log, if applicable. If a system or unclassified error occurs, the value is System Error. | Text |
The Status property can contain these values:
Code | Status Type | Message |
-1 | Error | Program error out. |
0 | Building Error | Program error out during building. |
1 | Building | Program building with activities, schedules, and other elements. |
2 | Ready | Program ready to start. |
3 | Running | Program running |
4 | Paused | Program paused from running state. |
5 | Stopped | Program stopped. |
6 | Scheduled | Program scheduled. |
7 | Awaiting Trigger | Program waiting for a trigger. |
8 | Inactive Trigger | Program trigger inactive. |
If you want to keep an eye on the automations in real time we can use the script listed below. This script utilizes the Automation object to get the automation details in real time. The Automation object defines automation in Automation Studio for an account.
var prox = new Script.Util.WSProxy();
for (i = 0; i < mids.length; i++)
{ var mid = mids[i];
prox.setClientId({"ID": mid});
var obj = "Automation";
var cols = ["ProgramID","CustomerKey","Status","Name", "IsActive","ModifiedDate"];
var filter = {
Property: "Status"
, SimpleOperator: "IN"
, Value: [-1,0,1,2,3,4,5,6,7,8]
};
var opts = null;
var props = null;
var moreObjs = true;
var reqID = null;
while (moreObjs) {
moreObjs = false;
var objs =reqID == null ? prox.retrieve(obj, cols, filter, opts, props) : prox.getNextBatch(obj, reqID);
if (objs != null)
{
moreObjs = objs.HasMoreRows;
reqID = objs.RequestID;
for (var j = 0; j < objs.Results.length; j++)
{
var automationObj = objs.Results[j];
var statusDsc = "";
switch (automationObj.Status)
{
case -1: statusDsc = "Error"; break;
case 0: statusDsc = "Building Error"; break;
case 1: statusDsc = "Building"; break;
case 2: statusDsc = "Ready"; break;
case 3: statusDsc = "Running"; break;
case 4: statusDsc = "Paused"; break;
case 5: statusDsc = "Stopped"; break;
case 6: statusDsc = "Scheduled"; break;
case 7: statusDsc = "Awaiting Trigger"; break;
case 8: statusDsc = "Inactive Trigger"; break;
}
var addedRowCount = Platform.Function.InsertData(
'Health Check Automation Status',
['MID', 'AutomationName', 'Status', 'IsActive', 'ModifiedDate', 'RecordUpdateDate', 'CustomerKey'],
[mid, automationObj.Name, statusDsc, automationObj.IsActive, automationObj.ModifiedDate, recordupdatedate, automationObj.CustomerKey]
);
}
}
}
prox.resetClientIds();
}console.log( 'Code is Poetry' );
The purpose of this research was to identify effective strategy in dealing with automation data_view. Based on the analysis it can be concluded that there are various ways to use this data_view as per the requirement. To deep dive further into Conversion Tracking of Marketing Cloud, send us an email on [email protected] or book a demo.