Chapter 5: Power Automate Flow Design
This chapter focuses on the Power Automate side of the integration. You'll learn how to create robust flows that receive webhooks from Business Central, parse JSON data, implement business logic, connect to external services, and handle errors gracefully.
By the end of this chapter, you'll be able to design production-ready Power Automate flows that reliably process Business Central events and integrate with your organization's ecosystem of services.
5.1 Creating Flows in Power Automate
Flow Types
Power Automate offers several flow types:
Automated Cloud Flows
Triggered by events (our use case)
HTTP request received from BC
No user interaction needed
Run in the background
This is what we use for BC integration
Instant Cloud Flows
Triggered manually by user
Button press in mobile app, SharePoint, Teams
Not suitable for BC automation
Scheduled Cloud Flows
Run on a schedule (daily, hourly, etc.)
Good for batch processing
Not event-driven
Desktop Flows
Robotic Process Automation (RPA)
Automate desktop applications
Not cloud-based
Business Process Flows
Guide users through multi-stage processes
Embedded in model-driven apps
Not suitable for BC integration
For Business Central Integration, Always Use: Automated Cloud Flow
Creating an Automated Cloud Flow
Step-by-Step Procedure:
Step 1: Access Power Automate
Navigate to https://make.powerautomate.com
Sign in with your Microsoft 365 or Dynamics 365 credentials
Ensure you're in the correct environment (check top-right dropdown)
Step 2: Create New Flow
Click "My flows" in left navigation
Click "+ New flow" button
Select "Automated cloud flow"
Step 3: Name Your Flow
Flow name field appears
Enter descriptive name:
Good: "BC Sales Order Posted - Email Notification"
Good: "BC Customer Credit Check"
Poor: "Test Flow"
Poor: "Flow 1"
Clear naming helps when debugging and reviewing run history
Step 4: Skip Trigger Selection
Dialog shows available triggers
Click "Skip" at bottom
We'll add HTTP trigger manually for more control
Step 5: Add HTTP Trigger
Click "+ Add a trigger" in canvas
Search box appears
Type "HTTP"
Select "When an HTTP request is received"
Trigger appears in canvas
Step 6: Save Flow
Click "Save" button (top right)
Flow is saved
HTTP trigger generates webhook URL
Copy webhook URL for use in BC
π NOTE: The webhook URL only appears after saving the flow. Save immediately after adding the HTTP trigger, then copy the URL to use in Business Central flow trigger configuration.
Flow Design Principles
Principle 1: Single Responsibility
Each flow should handle one specific business process:
Good Design:
Flow 1: Sales Order Posted β Email warehouse
Flow 2: Sales Order Posted β Update CRM
Flow 3: Customer Created β Add to mailing list
Each flow has a clear, single purpose.
Poor Design:
Flow 1: Sales Order Posted β Email warehouse, update CRM, add to SharePoint, post to Teams, create task, update external system...
Too complex, hard to debug, single point of failure.
Principle 2: Fail Fast
Validate inputs early in the flow:
Good Pattern:
Poor Pattern:
Principle 3: Idempotency
Design flows to handle duplicate webhooks safely:
Business Central might send the same event twice (rare but possible). Your flow should handle this gracefully:
Check if action already performed (query target system)
Use unique identifiers to detect duplicates
Make actions that can be safely repeated
Example:
Principle 4: Logging and Observability
Build in visibility:
Use "Compose" actions to format key data for run history
Add comments to actions explaining purpose
Use descriptive action names (not "Action 1", "Action 2")
Log errors to central location (SharePoint list, SQL table)
Principle 5: Error Handling
Every action that can fail should have error handling:
Use "Configure run after" to define error paths
Send notifications on failures
Log errors for investigation
Provide enough context to diagnose issues
π‘ TIP: Start with a simple flow (trigger + one action). Verify it works end-to-end. Then add complexity incrementally, testing after each addition.
Flow Naming and Organization
Naming Convention:
Format: [System] - [Event] - [Action]
Examples:
BC - Sales Order Posted - Email Warehouse
BC - Customer Created - CRM Sync
BC - Inventory Low - Teams Notification
BC - Invoice Posted - SharePoint Archive
Folder Organization (Environments):
Power Automate allows solutions and environments:
Development Environment:
All test flows
Experimental integrations
Sandbox BC connection
Production Environment:
Live flows only
Production BC connection
Strict change control
Use Solutions:
Group related flows into solutions
Example: "BC Sales Integration" solution contains all sales-related flows
Easier to migrate between environments
Better organization and governance
Flow Descriptions:
Every flow should have a description:
This provides essential context for maintenance and troubleshooting.
5.2 HTTP Trigger Configuration
Basic HTTP Trigger Setup
The HTTP trigger is already added to your flow. Now configure it properly:
Trigger Properties:
When you click on the HTTP trigger box, it expands to show:
HTTP POST URL
Generated automatically when flow is saved
Click copy icon to copy
Use this URL in BC flow trigger configuration
Regenerates if you delete and recreate trigger
Who can trigger the flow
Default: "Anyone" (not recommended for production)
Options:
Anyone: Any HTTP request with correct URL
Anyone with an InTune-managed device: Requires device management
Specific users in my organization: Requires authentication
For BC integration, typically use "Anyone" since BC authenticates via URL signature, but consider network restrictions for additional security.
Method
Always POST (fixed for this trigger)
BC sends HTTP POST requests
Request Body JSON Schema
Optional but strongly recommended
Defines expected JSON structure
Enables dynamic content in subsequent actions
Provides validation
Generating JSON Schema
The JSON schema helps Power Automate understand your webhook payload structure.
Method 1: Use Sample Payload
Step 1: Get Sample JSON from BC
Configure your BC flow trigger with JSON payload
Trigger a test event in BC
Check BC validation log for the sent JSON
Copy the complete JSON payload
Example Sample JSON:
Step 2: Generate Schema
In Power Automate, click the HTTP trigger
Scroll to "Request Body JSON Schema" field
Click "Use sample payload to generate schema" link
Paste your sample JSON
Click "Done"
Schema appears in field
Generated Schema Example:
Method 2: Write Schema Manually
If you're comfortable with JSON Schema syntax, write it directly:
The "required" array specifies which fields must be present.
Benefits of Defining Schema:
1. Dynamic Content After defining schema, subsequent actions show available fields in dynamic content picker:
@{triggerBody()?['documentNo']}
@{triggerBody()?['customerName']}
@{triggerBody()?['amount']}
Without schema, you must manually type field references.
2. Validation If BC sends JSON that doesn't match schema, the trigger fails and logs error. This catches configuration mistakes early.
3. IntelliSense Power Automate shows available fields as you type, reducing errors.
4. Documentation Schema documents expected payload structure for future maintainers.
π NOTE: Schema is optional but highly recommended. Without it, you can still access webhook data using expressions like triggerBody()['fieldName'], but you lose auto-complete and validation benefits.
Nested JSON Schemas
If your BC payload uses nested objects:
Sample Nested JSON:
Generated Nested Schema:
Accessing Nested Fields:
@{triggerBody()?['event']?['type']}@{triggerBody()?['order']?['number']}@{triggerBody()?['customer']?['name']}
Use ?['fieldName'] syntax for safe access (returns null if field missing rather than error).
Schema Validation Modes
Strict Mode (Recommended for Production):
"additionalProperties": false means BC cannot send extra fields not in schema. Helps catch errors.
Flexible Mode (Good for Development):
Allows extra fields. Good while iterating on payload design.
π‘ TIP: Use flexible mode during development. Once payload structure is stable, switch to strict mode to catch accidental changes.
5.3 Parsing Business Central Data
Accessing Webhook Data
After defining JSON schema, access webhook data in actions:
Dynamic Content Picker:
Add an action (e.g., "Send an email")
Click in a field (e.g., "Subject")
Lightning bolt icon appears
Click lightning bolt to open dynamic content picker
Section labeled "When an HTTP request is received" shows available fields
Click field to insert reference
Expression Editor:
For complex expressions, use the expression editor:
Click in field
Click "fx" button (Expression tab)
Write expression using Power Automate expression language
Click "OK" to insert
Common Expressions:
Simple Field Access:
Nested Field Access:
Conditional (If-Else):
String Concatenation:
Formatting Numbers:
Result: $15,450.00
Formatting Dates:
Result: December 09, 2025
π NOTE: The ?['fieldName'] syntax (with question mark) is null-safe. If the field doesn't exist, it returns null rather than causing an error. This is important for optional fields in your payload.
Parse JSON Action
For complex or dynamic JSON structures, use the "Parse JSON" action:
When to Use:
JSON structure varies between webhooks
Deeply nested JSON
Arrays in payload
Want explicit parsing step for clarity
Step-by-Step:
Step 1: Add Parse JSON Action
Click "+ New step" after HTTP trigger
Search for "Parse JSON"
Select "Parse JSON" (Data Operations)
Step 2: Configure Content
Click in "Content" field
Select "Body" from dynamic content (from HTTP trigger)
This is the raw JSON received from BC
Step 3: Define Schema
Click "Generate from sample"
Paste sample JSON payload
Click "Done"
Schema appears
Step 4: Use Parsed Fields
Subsequent actions show parsed fields in dynamic content
Access like: @{body('Parse_JSON')?['documentNo']}
Example Flow:
β οΈ WARNING: If you define schema on the HTTP trigger, you typically don't need Parse JSON actionβdynamic content is already available. Use Parse JSON when you need additional control or transformation of the received data.
Working with Arrays
If your BC payload includes arrays (rare but possible):
Example Payload with Array:
Accessing Array Elements:
First Element:
Result: "Item1"
Last Element:
Specific Index:
Result: "Item1" (0-based index)
Array Length:
Result: 3
Iterate Over Array (Apply to Each):
Add "Apply to each" action
In "Select an output from previous steps", choose the array field
Inside the loop, add actions
Current item referenced as:
item()
Example:
Sends 3 emails, one per array item.
Data Type Conversions
String to Integer:
String to Decimal:
Number to String:
Date String to DateTime:
Boolean from String:
π‘ TIP: If BC sends numeric fields without quotes (proper JSON numbers), Power Automate recognizes them as numbers automatically. No conversion needed. Check your BC JSON payload design in Chapter 3.
5.4 Common Flow Patterns
Pattern 1: Email Notification
Use Case: Send email when BC event occurs.
Flow Structure:
Key Points:
Use dynamic content for personalization
Keep email concise and actionable
Include link back to BC if possible
Consider HTML formatting for better readability
HTML Email Body:
Select "Yes" for "Is HTML" option in email action.
Pattern 2: Conditional Routing
Use Case: Different actions based on webhook data.
Flow Structure:
Condition Configuration:
Click "+ New step"
Search "Condition"
Select "Condition" (Control)
Choose field: triggerBody()?['amount']
Select operator: "is greater than"
Enter value: 10000
Add actions under "If yes" and "If no" branches
Multiple Conditions:
Use "Add" button to add multiple conditions with AND/OR logic:
Pattern 3: Approval Workflow
Use Case: Require human approval before proceeding.
Flow Structure:
Approval Action Configuration:
Approval type: Choose "Approve/Reject - First to respond" or "Approve/Reject - Everyone must approve"
Title: Concise description (appears in email subject)
Assigned to: Email addresses (comma-separated for multiple)
Details: Complete information for decision-making
Item link: Optional link back to BC (if you have web client URL)
Item link description: Text for link
Accessing Approval Outcome:
Pattern 4: SharePoint Integration
Use Case: Create or update SharePoint list items with BC data.
Flow Structure:
Or Update Existing:
π‘ TIP: SharePoint list columns must exist before flow can write to them. Create list structure first, then configure flow.
Pattern 5: Teams Notification
Use Case: Post message to Teams channel.
Flow Structure:
Adaptive Card (Richer Format):
Use "Post adaptive card in a chat or channel" for interactive cards:
Paste this JSON into "Message" field of adaptive card action, replacing placeholders.
Pattern 6: HTTP API Call
Use Case: Call external REST API with BC data.
Flow Structure:
Accessing HTTP Response:
Pattern 7: SQL Database Integration
Use Case: Insert BC data into SQL database.
Flow Structure:
Or Execute Stored Procedure:
Connection Setup:
First time: Flow prompts for SQL credentials
Subsequent uses: Reuses connection
Security: Connection stored securely in Power Automate
Pattern 8: Error Logging
Use Case: Log all webhook receptions for audit/troubleshooting.
Flow Structure:
This creates an audit trail of all integrations.
5.5 Error Handling in Flows
Understanding Flow Failures
Flows can fail at any action:
Common Failure Causes:
Network connectivity issues
Target system unavailable (SharePoint, Teams down)
Authentication expired (connector needs re-auth)
Invalid data (null values, wrong types)
Permission issues
Throttling limits exceeded
Without Error Handling:
Flow fails and stops
No notification sent
Partial work completed (data inconsistency)
Difficult to diagnose
With Error Handling:
Flow catches errors gracefully
Sends notifications
Logs errors for investigation
Completes cleanup actions
Provides context for troubleshooting
Configure Run After
Every action has "Configure run after" settings that control when it executes:
Accessing Configure Run After:
Click "..." menu on any action (except trigger)
Select "Configure run after"
Dialog shows checkboxes:
β is successful (default)
β has failed
β is skipped
β has timed out
Default Behavior:
Action runs only if previous action succeeded
If previous action fails, subsequent actions skip
Error Handling Behavior:
Check "has failed" to run action when previous fails
This creates error handling path
Basic Error Handling Pattern
Flow Structure:
Key Points:
Error path only runs if main action fails
Error notification sends detailed diagnostic info
Success path continues normal processing
Scope Action for Grouped Error Handling
For multiple actions, use "Scope" to group them and handle errors collectively:
Flow Structure:
Scope Benefits:
One error handler for multiple actions
Clear visual organization
Easier to manage complex flows
Better run history readability
Accessing Scope Results:
Try-Catch-Finally Pattern
Implement traditional programming error handling:
Flow Structure:
Benefits:
Familiar pattern for developers
Ensures cleanup always occurs
Clear separation of concerns
Retry Policies
Power Automate automatically retries failed actions:
Default Retry Policy:
4 retries over 24 hours
Exponential backoff (increasing delays)
Automatic for transient failures
Custom Retry Policy:
Click action settings ("..." menu)
Select "Settings"
Configure:
Retry Policy: Exponential (default) or Fixed interval
Retry Count: 0-90 retries
Retry Interval: PT5S (5 seconds), PT1M (1 minute), etc.
Timeout: PT1M (1 minute) to PT1H (1 hour)
Example: Aggressive Retry for Critical Actions
Example: No Retry for Idempotent Actions
β οΈ WARNING: Too many retries can cause duplicate actions. Only retry actions that are idempotent (safe to repeat) or have duplicate detection logic.
Accessing Error Information
When an action fails, error details are available:
Error Message:
Error Code:
Complete Error Object:
Example Error Notification:
This provides complete context for troubleshooting.
Dead Letter Queue Pattern
For critical integrations, implement a dead letter queue (DLQ):
Concept:
When flow fails repeatedly, log to special storage
Manual intervention required
Prevents data loss
Flow Structure:
Manual DLQ Processing:
Admin reviews DLQ entries periodically
Fixes underlying issues
Re-triggers flow manually or via script
Updates DLQ entry status to Processed
Testing Error Handling
Test Scenarios:
1. Test with Invalid Data
Send webhook with missing required field
Verify error path executes
Verify error notification sent
2. Test with Unreachable Service
Temporarily change SharePoint site URL to invalid
Trigger flow
Verify retries occur
Verify error handling activates
3. Test Timeout
Add "Delay" action set to 5 minutes in main scope
Set scope timeout to 1 minute
Trigger flow
Verify timeout error handling
4. Test Partial Success
Create flow with 3 actions
Make second action fail (invalid config)
Verify first action completed
Verify third action skipped
Verify error handling executed
π‘ TIP: Create a test flow with deliberate errors to verify your error handling logic works before deploying to production. Use "Terminate" action with status "Failed" to simulate errors.
This completes Chapter 5. You now understand how to create robust Power Automate flows with proper data parsing, common integration patterns, and comprehensive error handling.
Related Posts
Chapter 06: Troubleshooting and Best Practices
This final chapter provides systematic troubleshooting guidance, best practices for production deployments, performance optimization, security hardening, and ongoing maintenance strategies. Apply these principles to ensure reliable, secure, and maintainable Power Automate integrations with Business Central.
Chapter 05: Power Automate Flow Design
This chapter focuses on the Power Automate side of the integration. You'll learn how to create robust flows that receive webhooks from Business Central, parse JSON data, implement business logic, connect to external services, and handle errors gracefully.
Chapter 04: Configuring Rules and Conditions
This chapter explores the rule engine that determines when flow triggers execute. You'll learn how triggers monitor Business Central tables, how scenarios add conditional logic, and how rule groups filter by user or role. Mastering these concepts allows you to create sophisticated, targeted integrations that fire only when specific conditions are met.
