---
schema_version: "1"
id: fdf4302f205dc40c71d10ab8556c02ac5cc588b24aa938e83be0b89dfbf1ef8a
title: "Data View: Automation Activity Instance"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_as_data_view_automation_activity_instance.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_automation_activity_instance.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 1f9368cec33c7769bd23f5aee4e5c87d91e3017a741b96fc8554033e56d565d8
description: Improve the efficiency and success rate of your automations by reviewing automation activity health. Query the _AutomationActivityInstance data view in Automation Studio to prevent failures by identifying activities that often fail or run long.
products:
  - Marketing
  - Marketing Cloud Engagement
release: "264"
---
# Data View: Automation Activity Instance

Improve the efficiency and success rate of your automations by reviewing automation activity health. Query the \_AutomationActivityInstance data view in Automation Studio to prevent failures by identifying activities that often fail or run long.

## What This Data View Shows

- 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

## What You Need to Know

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small "><colgroup><col style="width:50%"> <col style="width:50%"></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">How to activate the data view</td><td class="slds-cell-wrap" style="vertical-align:top;">Available by default</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">When data is available</td><td class="slds-cell-wrap" style="vertical-align:top;">Data in this view is available in real-time</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">How much data is available</td><td class="slds-cell-wrap" style="vertical-align:top;">Data for automations that ran in the last 6 months</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Data view scope</td><td class="slds-cell-wrap" style="vertical-align:top;">Single business unit</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Time zone</td><td class="slds-cell-wrap" style="vertical-align:top;">UTC</td></tr></tbody></table>

## Questions That You Can Answer

**Which Automations Are Failing and Why?**

Identify the cause of automation errors to prevent future failures. An automation error can be categorized as a configuration error or system error.

- A configuration error occurs because an activity or dependency isn’t set up correctly. For example, if a file transfer activity is looking for a file named test.csv and the file doesn’t exist. Modify your automation or its dependencies to solve a configuration error.
- A system error is more general and often temporary. For example, if a server runs out of memory or a connection fails. In many cases, you don’t need to change your automation to solve a system error, and you can run the automation again.

Use this query to find activities that failed because of a configuration error. Check the error message to learn how you can address the error.

```
SELECT activitycustomerkey
FROM   [_automationactivityinstance]
WHERE activityinstancestatus = 'Error'
       AND activityinstancestatusdetails LIKE 'System Error occurred%'
```

Use this query to find activities that failed because of a system error. Retry the associated automation.

```
SELECT activitycustomerkey
FROM   [_automationactivityinstance]
WHERE activityinstancestatus = 'Error'
       AND activityinstancestatusdetails NOT LIKE 'System Error occurred%' 
```

**Which Activities Are at Risk of Timing Out?**

Proactively identify long-running activities that are approaching the 30-minute time limit.

Use this query to find query activities with an average duration greater than 20 minutes. Optimize the query activity, or break it up into multiple steps.

```
SELECT activitycustomerkey,
       avgduration
FROM   (SELECT activitycustomerkey,
               Avg(Datediff(minute, activityinstancestarttime_utc,
                   activityinstanceendtime_utc)
               ) AS AvgDuration
        FROM   [_automationactivityinstance] activity
        WHERE  activity.activitytype = 300
        GROUP  BY activitycustomerkey) durations
WHERE  avgduration > 20
```

Use this query to find SSJS activities with an average duration greater than 20 minutes. Optimize the SSJS activity, or break it up into multiple steps.

```
SELECT activitycustomerkey,
       avgduration
FROM   (SELECT activitycustomerkey,
               Avg(Datediff(minute, activityinstancestarttime_utc,
                   activityinstanceendtime_utc)
               ) AS AvgDuration
        FROM   [_automationactivityinstance] activity
        WHERE  activity.activitytype = 150
        GROUP  BY activitycustomerkey) durations
WHERE  avgduration > 20
```

**What is the Average Duration of Each Activity?**

Track the average performance of your activities to find trends and investigate problems before they impact critical processes. Use this query to determine each activity’s average duration over the past 6 months.

```
SELECT activitycustomerkey,
       Avg(Datediff(minute, activityinstancestarttime_utc,
           activityinstanceendtime_utc)
       ) AS AvgDuration
FROM   [_automationactivityinstance] activity
GROUP  BY activitycustomerkey
```

## Data View Columns

    
| Name | Description | DataType | Data Extension Data Type | Nullable |
| --- | --- | --- | --- | --- |
| MemberID | The unique ID of the business unit. | BIGINT | Number |   |
| JobID | The job ID number for the email send | INT | Number | X |
| AutomationName | The automation name. | NVARCHAR(400) | Text |   |
| AutomationCustomerKey | The unique ID of the automation. | NVARCHAR(400) | Text |   |
| AutomationInstanceID | The unique ID of the automation run. | UNIQUEIDENTIFIER | Text |   |
| ActivityType | The activity type. Possible values are listed in the Activity Type IDs table. | INT | Number |   |
| ActivityName | The activity name. | NVARCHAR(400) | Text |   |
| ActivityDescription | The activity description. | NVARCHAR(400) | Text | X |
| ActivityCustomerKey | The unique ID of the activity. | NVARCHAR(400) | Text |   |
| ActivityInstanceStep | Where the activity occurs in the automation. For example, 3.2 is step 3, activity 2. | VARCHAR(25) | Text |   |
| ActivityInstanceID | The unique ID of the activity run. | UNIQUEIDENTIFIER | Text |   |
| ActivityInstanceStartTime\_UTC | The time that the activity run started. This value is null if the automation was skipped. | DATETIMEOFFSET | Date | X |
| 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. | DATETIMEOFFSET | Date | X |
| ActivityInstanceStatus | The status of the activity run when the data view is queried. Possible values are Initialized, Executing, Complete, Error, or NotSelected. | NVARCHAR(256) | Text |   |
| ActivityInstanceStatusDetails | The message from the error log, if applicable. If a system or unclassified error occurs, the value is System Error. | NVARCHAR(4000) | Text | X |

## Activity Type IDs

 
| Activity Type ID | Activity Name |
| --- | --- |
| 33 | SMS Activity |
| 42 | Send Email |
| 43 | Data Copy or Import |
| 45 | Refresh Group |
| 53 | File Transfer |
| 73 | Data Extract |
| 84 | Report Definition |
| 300 | SQL Query |
| 303 | Filter |
| 423 | Script |
| 425 | Data Factory Utility Activity |
| 426 | Refresh Segment Template |
| 427 | Publish Audience |
| 467 | Wait |
| 615 | Verify Audience Count |
| 724 | Refresh Mobile Filtered List |
| 725 | Send SMS |
| 726 | Import Mobile Contacts |
| 733 | Journey Builder Event Activity |
| 736 | Send Push |
| 749 | Fire Event |
| 771 | Salesforce Email Send |
| 772 | Mobile Connect Send Salesforce Sync Subscriber |
| 783 | Send GroupConnect |
| 952 | Journey Builder Event Activity |
| 1000 | Verification |
| 1010 | Interaction Studio Data |
| 1101 | Interactions |
| 1701 | Batch Personalization |
| 3700 | Contact to Business Unit Mapping |