sfmc // Automation HealthPRODUCTION

Latest Run Status per Automation

Return the latest known Automation Studio run for each AutomationCustomerKey.

sqlautomation studioautomationinstancerow_number
Context Pack →Open Workspace →
Trust & provenancePRODUCTION
Evidence tierPRODUCTIONOfficial sources1Other sources0Last verified2026-10-05

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

EvidencePRODUCTION
Difficultyintermediate
Verified2026-10-05
Use when

Building an Automation health dashboard.

Finding automations whose most recent run is Error, Stopped or unexpectedly old.

SELECT
    AutomationCustomerKey,
    AutomationName,
    AutomationInstanceID,
    AutomationInstanceStatus,
    AutomationInstanceStartTime_UTC,
    AutomationInstanceEndTime_UTC
FROM (
    SELECT
        AutomationCustomerKey,
        AutomationName,
        AutomationInstanceID,
        AutomationInstanceStatus,
        AutomationInstanceStartTime_UTC,
        AutomationInstanceEndTime_UTC,
        ROW_NUMBER() OVER (
            PARTITION BY AutomationCustomerKey
            ORDER BY AutomationInstanceEndTime_UTC DESC
        ) AS rn
    FROM _AutomationInstance
) x
WHERE rn = 1
Why it works

ROW_NUMBER ranks runs within each automation by latest end time, producing one current operational snapshot per AutomationCustomerKey.

Operational notes

The data view is real-time, BU-scoped and keeps six months of run history.

If your account has multiple notification recipients, deduplicate around AutomationInstanceID because Salesforce can emit one row per recipient.

Related
Sources / verification