web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate flow to...
Power Automate
Suggested Answer

Power Automate flow to trigger email when any of the Azure synapse link table sync fails

(0) ShareShare
ReportReport
Posted on by 4

Can someone help identify the correct field or table that captures the error status of a Synapse Link sync job?
 

I’ve checked the synapselinkprofileentitystate table, which contains a syncstatus field, but it doesn't consistently reflect the actual error state.

I'm looking for a more reliable way to track sync failures, especially for entities that encounter issues during synchronization.
 


Categories:
I have the same question (0)
  • Riyaz_riz11 Profile Picture
    3,893 Super User 2025 Season 2 on at
    Hi,
     

    Flow Setup: "Synapse Link Error Monitor"

    Step 1: Initialize Variables

    Variables:
    - ErrorThreshold: 5 (number of consecutive errors before alert)
    - MonitoringInterval: 15 (minutes)
    - LastRunTime: addMinutes(utcNow(), -15)
    - ErrorLog: []
    - AlertRecipients: ["admin@company.com"]
    - SyncStatusValues: ["Error", "Failed", "Exception", "Stopped"]

    Step 2: Query Primary Status Table

    Action: List rows (Dataverse)
    Table: synapselinkprofileentitystate
    Filter Query: 
      (syncstatus eq 'Error' or 
       syncstatus eq 'Failed' or 
       syncstatus eq 'Exception' or
       syncstatus eq 'Stopped' or
       modifiedon ge @{variables('LastRunTime')})
       
    Select columns: 
      - synapselinkprofileentitystateid
      - entityname
      - syncstatus  
      - statusreason
      - modifiedon
      - _synapselinkprofileentity_value
      - errormessage
      - lastsuccessfulsynctime

    Step 3: Query Additional Error Details

    Action: List rows (Dataverse)
    Table: synapselinkprofileentityrun
    Filter Query: 
      (runstatus eq 'Error' or 
       runstatus eq 'Failed' or
       runstatus eq 'Exception' or
       modifiedon ge @{variables('LastRunTime')})
       
    Select columns:
      - runid
      - runstatus
      - errormessage
      - errorcode
      - starttime
      - endtime
      - recordsprocessed
      - recordsfailed
      - _synapselinkprofileentity_value

    Step 4: Cross-Reference with Profile Data

    Action: List rows (Dataverse)
    Table: synapselinkprofile
    Filter Query: statecode eq 0
    Select columns:
      - synapselinkprofileid
      - name
      - destinationtype
      - storageaccountname
      - workspacename
      - statecode
      - statuscode

    Step 5: Enhanced Error Analysis

    Apply to each - Error Records:
      Compose - Error Details:
        EntityName: @{item()?['entityname']}
        SyncStatus: @{item()?['syncstatus']}
        StatusReason: @{item()?['statusreason']}
        ErrorMessage: @{item()?['errormessage']}
        LastModified: @{item()?['modifiedon']}
        LastSuccessfulSync: @{item()?['lastsuccessfulsynctime']}
        ProfileEntityId: @{item()?['_synapselinkprofileentity_value']}
        
      # Get additional context from profile entity
      Get row by ID (Dataverse):
        Table: synapselinkprofileentity
        Row ID: @{item()?['_synapselinkprofileentity_value']}
        
      # Append to error log
      Append to array variable - ErrorLog:
        @{outputs('Compose_-_Error_Details')}
     
     

    Solution 2: Real-time Error Notification Flow

    Flow Setup: "Real-time Synapse Error Alert"

    Trigger: When a row is added, modified or deleted

    Table: synapselinkprofileentitystate
    Filter rows: syncstatus eq 'Error' or syncstatus eq 'Failed'
    Run settings: 
      - Trigger conditions: @equals(triggerOutputs()?['body/syncstatus'], 'Error')

    Actions:

    1. Get Related Profile Information:
       Get row by ID (Dataverse):
         Table: synapselinkprofileentity
         Row ID: @{triggerOutputs()?['body/_synapselinkprofileentity_value']}
    
    2. Get Recent Run Details:
       List rows (Dataverse):
         Table: synapselinkprofileentityrun
         Filter: _synapselinkprofileentity_value eq '@{triggerOutputs()?['body/_synapselinkprofileentity_value']}'
         Order by: modifiedon desc
         Top count: 1
    
    3. Compose Error Summary:
       {
         "EntityName": "@{triggerOutputs()?['body/entityname']}",
         "SyncStatus": "@{triggerOutputs()?['body/syncstatus']}",
         "ErrorMessage": "@{triggerOutputs()?['body/errormessage']}",
         "ProfileName": "@{outputs('Get_row_by_ID')?['body/name']}",
         "ErrorTime": "@{triggerOutputs()?['body/modifiedon']}",
         "RunDetails": "@{first(outputs('List_rows_-_Recent_Runs')?['body/value'])}"
       }
    
    4. Send Alert:
       Send an email (V2):
         To: @{variables('AlertRecipients')}
         Subject: "Synapse Link Sync Error - @{triggerOutputs()?['body/entityname']}"
         Body: [Formatted HTML with error details]
     
     

    Solution 3: Comprehensive Health Dashboard Flow

     

    Flow Setup: "Synapse Link Health Dashboard"

     

    Trigger: Recurrence (Every 30 minutes)

    Actions:

    1. Get All Entity States:
       List rows (Dataverse):
         Table: synapselinkprofileentitystate
         Select columns: entityname, syncstatus, modifiedon, lastsuccessfulsynctime
         
    2. Get All Profiles:
       List rows (Dataverse):
         Table: synapselinkprofile
         Select columns: name, statecode, statuscode, modifiedon
    
    3. Calculate Health Metrics:
       Apply to each - Entity States:
         Compose - Health Check:
           EntityName: @{item()?['entityname']}
           Status: @{item()?['syncstatus']}
           IsHealthy: @{if(or(equals(item()?['syncstatus'], 'Error'), equals(item()?['syncstatus'], 'Failed')), false, true)}
           LastSync: @{item()?['lastsuccessfulsynctime']}
           TimeSinceLastSync: @{div(sub(ticks(utcNow()), ticks(item()?['lastsuccessfulsynctime'])), 10000000)}
           
    4. Create Dashboard Data:
       Compose - Dashboard Summary:
         TotalEntities: @{length(outputs('List_rows_-_Entity_States')?['body/value'])}
         HealthyEntities: @{length(where(variables('HealthChecks'), equals(item()?['IsHealthy'], true)))}
         ErrorEntities: @{length(where(variables('HealthChecks'), equals(item()?['IsHealthy'], false)))}
         LastUpdated: @{utcNow()}
         
    5. Update Dashboard (SharePoint List or Power BI):
       Create item (SharePoint):
         List: "Synapse Link Health Dashboard"
         Title: "Health Check - @{formatDateTime(utcNow(), 'yyyy-MM-dd HH:mm')}"
         Summary: @{outputs('Compose_-_Dashboard_Summary')}

    Solution 4: Advanced Error Pattern Detection

    Flow Setup: "Error Pattern Analyzer"

    Trigger: Scheduled (Daily at 8 AM)

    Actions:

    1. Get Historical Error Data:
       List rows (Dataverse):
         Table: synapselinkprofileentitystate
         Filter: modifiedon ge @{addDays(utcNow(), -7)}
         Order by: modifiedon desc
         Top count: 1000
    
    2. Analyze Error Patterns:
       Apply to each - Error Records:
         Condition - Check for recurring errors:
           @contains(item()?['errormessage'], 'timeout')
           @contains(item()?['errormessage'], 'permission')
           @contains(item()?['errormessage'], 'storage')
           @contains(item()?['errormessage'], 'network')
           
    3. Generate Pattern Report:
       Compose - Pattern Analysis:
         TimeoutErrors: @{length(where(variables('ErrorData'), contains(item()?['errormessage'], 'timeout')))}
         PermissionErrors: @{length(where(variables('ErrorData'), contains(item()?['errormessage'], 'permission')))}
         StorageErrors: @{length(where(variables('ErrorData'), contains(item()?['errormessage'], 'storage')))}
         NetworkErrors: @{length(where(variables('ErrorData'), contains(item()?['errormessage'], 'network')))}
         
    4. Send Weekly Report:
       Send an email (V2):
         Subject: "Weekly Synapse Link Error Pattern Report"
         Body: [Formatted report with patterns and recommendations]
     
     

    Solution 5: Automated Recovery Flow

    Flow Setup: "Synapse Link Auto-Recovery"

    Trigger: When error detected (from Solution 2)

    Actions:

    1. Analyze Error Type:
       Switch - Error Message:
         Case 'timeout':
           # Wait and retry
           Delay: PT5M
           Call: "Retry Sync Flow"
           
         Case 'permission':
           # Send alert to admin
           Send notification
           
         Case 'storage':
           # Check storage account status
           HTTP: GET Storage Account Status
           
         Default:
           # Log for manual review
           Create item in "Manual Review Queue"
    
    2. Retry Logic:
       Do until - Success or Max Attempts:
         # Attempt to restart sync
         # Check if error is resolved
         # Increment retry counter
         
    3. Log Recovery Attempt:
       Create item (Dataverse):
         Table: Custom "Recovery Log"
         Fields: EntityName, ErrorType, RecoveryAction, Success, Timestamp
     
     

    Key Fields for Error Tracking

    synapselinkprofileentitystate Table:

    Critical Fields:
    - syncstatus: Current sync status
    - statusreason: Detailed reason code
    - errormessage: Error description
    - lastsuccessfulsynctime: Last successful sync
    - modifiedon: Last status change
    - entityname: Entity being synced

    synapselinkprofileentityrun Table:

    Critical Fields:
    - runstatus: Individual run status
    - errormessage: Run-specific error message
    - errorcode: Structured error code
    - recordsprocessed: Number of records processed
    - recordsfailed: Number of failed records
    - starttime/endtime: Run duration
     
     

    Status Values to Monitor

    Error Status Values:

    Primary Error States:
    - "Error" - General error state
    - "Failed" - Failed sync attempt
    - "Exception" - System exception occurred
    - "Stopped" - Sync stopped unexpectedly
    
    Warning States:
    - "Warning" - Partial success with issues
    - "Queued" - Stuck in queue (potential issue)
    - "Processing" - Long-running process (monitor for timeout)
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
  • Suggested answer
    UP-08070931-0 Profile Picture
    4 on at
    @Riyaz_riz11

    The syncstatus column in the synapselinkprofileentitystate table is not accurately reflecting the actual sync status. Even when the sync shows an error in the UI, the backend still shows syncstate = 1. Additionally, I don't see the statusreason or errormessage columns in this table.
     
    I also noticed that the synapselinkprofileentityrun table is not available in the environment.".

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 507 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 267 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard