I’ll address all three critical aspects of your bulk import challenge:
1. Power Automate Error Handling Implementation:
First, restructure your flow to use proper error handling patterns. Add a ‘Scope’ action to wrap your lead creation logic, then add a parallel ‘Configure run after’ path that only runs on failure:
// Scope: Create Lead with Workflows
// Configure run after settings:
{
"runAfter": {},
"type": "Scope",
"actions": {
"Create_Lead": { "type": "ApiConnection" },
"Trigger_Territory_Assignment": { "type": "Workflow" }
}
}
Add error capture:
// Parallel branch - runs on failure
"Log_Failed_Record": {
"runAfter": { "Create_Lead_Scope": ["Failed", "TimedOut"] },
"type": "Compose",
"inputs": {
"LeadEmail": "@{items('Apply_to_each')?['email']}",
"ErrorCode": "@{outputs('Create_Lead')?['statusCode']}",
"ErrorMessage": "@{body('Create_Lead')?['error']?['message']}"
}
}
2. Parallel Branch Design for Scalability:
The key is separating immediate import from deferred workflow processing:
This architecture prevents the cascading API calls that cause throttling.
3. Error Logging for Failed Records:
Implement a comprehensive logging mechanism:
-
Create a custom Dataverse table ‘Import Error Log’ with fields:
- Source Record ID (text)
- Error Type (option set: Throttling, Validation, Timeout)
- Error Details (multiline text)
- Retry Count (number)
- Import Batch ID (GUID)
-
In your flow, after each failed create operation, insert a record into this table
-
Create a companion flow that runs every 10 minutes, queries error logs with RetryCount < 3, and reattempts the import
-
For 429 errors specifically, respect the Retry-After header value
Immediate Fix for Your Current Situation:
- Export the list of successfully imported leads (800-1,000 records)
- Use Excel to identify the missing 40% from your source data
- Create a new CSV with only the failed records
- Temporarily disable territory assignment workflows
- Import the failed records using the updated flow with concurrency=1
- Re-enable workflows and let Flow 2 process assignments
Additional Recommendations:
- Use the Dataverse ‘CreateMultiple’ action (available in 9.1) instead of individual creates - it batches up to 1,000 records in a single API call
- Monitor your flow runs in the Power Automate admin center to track API consumption
- Consider using the ‘Postpone’ pattern for workflows - store workflow parameters in a queue table and process them asynchronously
This approach has successfully handled imports of 50,000+ records for multiple clients without hitting throttling limits.
This draft is based on general Microsoft Dynamics 365 Sales knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.